I have a situation where I would like to be able to add property definitions from code behind, however it doesn't appear to be working properly.
Here's what I have: I made a custom object for use in xaml called a PropertyDefinitionList:
In a resource dictionary I instance such a list like follows:
Here's what I have: I made a custom object for use in xaml called a PropertyDefinitionList:
public class PropertyDefinitionList : List<
Telerik.Windows.Controls.Data.PropertyGrid.PropertyDefinition
>
{
public PropertyDefinitionList() { }
}
In a resource dictionary I instance such a list like follows:
<
local:ObjectPropertyFilterList
x:Key
=
"PropertyDefinitions"
>
<
propertyGrid:PropertyDefinition
Binding
=
"{Binding Name}"
/>
<
propertyGrid:PropertyDefinition
Binding
=
"{Binding ID}"
/>
</
local:ObjectPropertyFilterList
>
I get a reference to this list in my code behind and call it PropertyList. At a certain
point I want to the property definitions to the .PropertyDefinitions collection on the
RadPropertyGrid, so in the function that does it I have the following code:rpg1.PropertyDefinitions.AddRange(propertyDefinitionList1);
rpg1.item = targetitem;
However when the code executes I get two blank definition entries in the property grid
display. There is no display name nor value. The properties definitely exist in the object
being assigned to "item", but its like these property definitions don't get their binding
set. In another thread it was stated that property definitions have their binding
evaluated when the .item property changes, so what is happening (or not happening) here? I
figure I must be doing something wrong.
Thanks!