diff --git a/Torch/Views/PropertyGrid.xaml.cs b/Torch/Views/PropertyGrid.xaml.cs index 278b1b0..23e2ef6 100644 --- a/Torch/Views/PropertyGrid.xaml.cs +++ b/Torch/Views/PropertyGrid.xaml.cs @@ -181,7 +181,7 @@ namespace Torch.Views { Content = "Edit Collection" }; - button.SetBinding(Button.DataContextProperty, $"{property.Name}"); + button.SetBinding(Button.DataContextProperty, property.Name); var gt = propertyType.GetGenericArguments()[0]; @@ -197,11 +197,21 @@ namespace Torch.Views valueControl = button; } - else + else if (propertyType.IsPrimitive || propertyType == typeof(string)) { valueControl = new TextBox(); valueControl.SetBinding(TextBox.TextProperty, property.Name); } + else + { + var button = new Button + { + Content = "Edit Object" + }; + button.SetBinding(Button.DataContextProperty, property.Name); + button.Click += (sender, args) => EditObject(((Button)sender).DataContext); + valueControl = button; + } valueControl.Margin = new Thickness(3); valueControl.VerticalAlignment = VerticalAlignment.Center; @@ -241,6 +251,11 @@ namespace Torch.Views new ObjectCollectionEditor().Edit(c, title); } + private void EditObject(object o, string title = "Edit Object") + { + new ObjectEditor().Edit(o, title); + } + private void UpdateFilter(object sender, TextChangedEventArgs e) { var filterText = ((TextBox)sender).Text;