I've spent the last day tracking down a weird bug. I copy/pasted an existing PropertyDefinition into a new View but it just did not work. The values were not displaying. I finally tracked it down.
My definitions are:
As you can see in the comments the controls are basically identical, the only difference is the 2nd one has a DataTemplate with a TextBlock in it. This TextBlock is completely empty.
I finally found the one difference between my views that fixed the problem.
I'm just wondering why this matters. Is it a bug? Did I leave something important out and this triggers it? Adding the above property directly to the control does not fix it - only when we use a Style.
Note that the controls in the DataTemplate will render, e.g. if I set Background="Red", but the Text will not display even if it is hard coded to a string.
My definitions are:
<!-- This one works -->
<
PropertyGrid:PropertyDefinition
Binding
=
"{Binding Stock.Name}"
GroupName
=
"Stock"
DisplayName
=
"Name"
OrderIndex
=
"9"
/>
<!-- This one does not show any text, even the FallbackValue when I intentionally mistype the binding path -->
<
PropertyGrid:PropertyDefinition
Binding
=
"{Binding Stock.Name}"
GroupName
=
"Stock"
DisplayName
=
"Name"
OrderIndex
=
"10"
>
<
PropertyGrid:PropertyDefinition.EditorTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Stock.Name, TargetNullValue='The value is null', FallbackValue='Problem getting text'}"
/>
</
DataTemplate
>
</
PropertyGrid:PropertyDefinition.EditorTemplate
>
</
PropertyGrid:PropertyDefinition
>
As you can see in the comments the controls are basically identical, the only difference is the 2nd one has a DataTemplate with a TextBlock in it. This TextBlock is completely empty.
I finally found the one difference between my views that fixed the problem.
<
UserControl.Resources
>
<
Style
TargetType
=
"Controls2:RadPropertyGrid"
>
<
Setter
Property
=
"ScrollViewer.HorizontalScrollBarVisibility"
Value
=
"Disabled"
/>
</
Style
>
</
UserControl.Resources
>
I'm just wondering why this matters. Is it a bug? Did I leave something important out and this triggers it? Adding the above property directly to the control does not fix it - only when we use a Style.
Note that the controls in the DataTemplate will render, e.g. if I set Background="Red", but the Text will not display even if it is hard coded to a string.