| 1234567891011121314151617181920212223242526272829303132333435363738 | using System.Windows;using NPOI.OpenXmlFormats.Spreadsheet;namespace InABox.DynamicGrid;public partial class DynamicContentDialog : Window{    public static readonly DependencyProperty CanSaveProperty = DependencyProperty.Register(nameof(CanSave), typeof(bool), typeof(DynamicContentDialog));    public bool ButtonsVisible    {        get => Buttons.Visibility == Visibility.Visible;        set => Buttons.Visibility = value ? Visibility.Visible : Visibility.Collapsed;    }    public bool CanSave    {        get => (bool)GetValue(CanSaveProperty);        set => SetValue(CanSaveProperty, value);    }    public DynamicContentDialog(FrameworkElement element, bool buttonsvisible = true)    {        InitializeComponent();        ButtonsVisible = buttonsvisible;        Presenter.Content = element;    }    private void OKButton_Click(object sender, RoutedEventArgs e)    {        DialogResult = true;    }    private void CancelButton_Click(object sender, RoutedEventArgs e)    {        DialogResult = false;    }}
 |