private void Button_Click(object sender, RoutedEventArgs e) { var value = (sender as Button).DataContext; MetroDialog.ShowDialog(value.GetType().Name, new AutoPropertyGrid() { Value = value, MaxWidth = 400, MinWidth = 300 }, this, showCancel: false); }
//private void UpdateSymbolEditor() //{ // if (Symbol is SimpleMarkerSymbol sms) // { // SymbolEditorContent.Content = new SymbolEditors.SimpleMarkerSymbolEditor() { Symbol = sms }; // } // else if (Symbol is Esri.ArcGISRuntime.Symbology.MultilayerSymbol mls) // { // SymbolEditorContent.Content = new AutoPropertyGrid() { Value = mls }; // //SymbolEditorContent.Content = new SymbolEditors.MultilayerSymbolEditor() { Symbol = mls }; // } // else // { // SymbolEditorContent.Content = new AutoPropertyGrid() { Value = Symbol }; // //SymbolEditorContent.Content = new TextBlock() { Text = "Symbol type not yet supported " }; // } //} private void PickFromSymbolStyle_Click(object sender, RoutedEventArgs e) { var picker = new SymbolPicker(); if (MetroDialog.ShowDialog("Symbol Picker", picker, this) == true) { var symbol = picker.SelectedItem?.Symbol; if (symbol != null) { Symbol = symbol; } } }
private void Button_Click(object sender, RoutedEventArgs e) { var value = (sender as Button).DataContext; MetroDialog.ShowDialog(value.GetType().Name, new AutoPropertyGrid() { Value = value, MaxWidth = 400, MinWidth = 300 }, this, showCancel: false); // Trigger refresh var items = Items.ItemsSource; Items.ItemsSource = null; Items.ItemsSource = items; }
public static bool?ShowDialog(string title, UIElement content, UIElement parent, bool showCancel = true, bool showAccept = true) { var window = parent as Window; while (window is null && parent != null) { parent = VisualTreeHelper.GetParent(parent) as UIElement; window = parent as Window; } var d = new MetroDialog() { Child = content, Title = title, Owner = window }; d.acceptButton.Visibility = showAccept ? Visibility.Visible : Visibility.Collapsed; d.cancelButton.Visibility = showCancel ? Visibility.Visible : Visibility.Collapsed; var result = d.ShowDialog(); d.Child = null; return(result); }