private void PropertyGrid_Loaded(object sender, RoutedEventArgs e)
            {
                PropertyGrid grid = sender as PropertyGrid;

                if (grid.DataContext != null && grid.DataContext.GetType() == typeof(DictionaryPropertyGridAdapter) && !isMaterialEditor)
                {
                    EditorTemplateDefinition tex = new EditorTemplateDefinition();
                    tex.EditingTemplate = FindResource("TextureEditor") as DataTemplate;
                    tex.TargetProperties.Add(new TargetPropertyType()
                    {
                        Type = typeof(Texture2D)
                    });
                    grid.EditorDefinitions.Add(tex);
                    grid.EditorDefinitions.Insert(0, tex);
                    isMaterialEditor = true;
                }
                if (Parent is MaterialInspector)
                {
                    MaterialInspector matEditor = Parent as MaterialInspector;
                    grid.IsReadOnly = matEditor.Material == Material.StandardMaterial;
                }
                grid.ExpandAllProperties();
            }
Beispiel #2
0
 public MainWindow()
 {
     InitializeComponent();
     PropertyGrid.ExpandAllProperties();
 }