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; } }