Posted 16 years ago
by Naomi Weiser
I created an editor with a DataTemplate and ResourceDictionary.
How can I add my editor from code to my property class , like the following which works for your editors?
class...
{
[Editor(typeof(CheckBoxPropertyEditor), typeof(PropertyEditor))]
public bool MyProperty {...}
}
I am able to add my editor as follows:
PropertyGridPropertyItem item = new PropertyGridPropertyItem();
item.DisplayName = "prop11";
item.Value = 14;
MyEditorResources resources = new MyEditorResources();
item.ValueTemplate = resources.HexEditor;
propertyGrid.Properties.Add(item);
class MyEditorResources:ResourceDictionary
{
public DataTemplate PhoneNumberEditor
{
get { return (DataTemplate)this["PhoneNumberEditor"]; }
}
}
How can I add my editor from code to my property class , like the following which works for your editors?
class...
{
[Editor(typeof(CheckBoxPropertyEditor), typeof(PropertyEditor))]
public bool MyProperty {...}
}
I am able to add my editor as follows:
PropertyGridPropertyItem item = new PropertyGridPropertyItem();
item.DisplayName = "prop11";
item.Value = 14;
MyEditorResources resources = new MyEditorResources();
item.ValueTemplate = resources.HexEditor;
propertyGrid.Properties.Add(item);
class MyEditorResources:ResourceDictionary
{
public DataTemplate PhoneNumberEditor
{
get { return (DataTemplate)this["PhoneNumberEditor"]; }
}
}