I use a PropertyGrid and I want to add a new property to keep the height and width ratio of any selected item. How can I add a new property having type bool (CheckBox)?
I tried this:
var propertyDefinition = new PropertyDefinition()
{
Category = "Layout",
DisplayName = "KeepRatio",
TargetProperties = new string[] { "KeepRatio" },
HasAttribute = typeof(Boolean)
};
propertyGrid1.PropertyDefinitions.Add(propertyDefinition);
If your
PropertyGridis defined in XAML like this:Then you can create the property definitions in code-behind like this:
However, you can do this also entirely in XAML, if you can bind your data object.