Hello
I need change some PropertyDefinition's IsEnabled on run time,my solution is change PropertyDefinition's IsReadonly
public virtual void SetEnabled()
{
var squidProperties = this.FindChildByType<RadPropertyGrid>() as RadPropertyGrid;
if (squidProperties == null)
return;
foreach (var item in squidProperties.PropertyDefinitions)
{
item.IsReadOnly = !_enable;
if (item.HasNestedProperties)
{
foreach (var subItem in item.NestedProperties)
{
subItem.IsReadOnly = !_enable;
}
}
}
}
when the PropertyDefinition has EditorTemplate, when the EditorTemplate is single control as the following code it is works right
<telerik:PropertyDefinition.EditorTemplate>
<DataTemplate>
<telerik:RadWatermarkTextBox
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource AncestorType=telerik:PropertyGridField}}"
Text="{Binding Filter}" />
</DataTemplate>
</telerik:PropertyDefinition.EditorTemplate>
but when the EditorTemplate is nested controls as the following code, it is works wrong
<telerik:PropertyDefinition.EditorTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<telerik:RadWatermarkTextBox Grid.Column="0"
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource AncestorType=telerik:PropertyGridField}}"
Text="{Binding Filter}" />
<telerik:RadButton />
</Grid>
</DataTemplate>
</telerik:PropertyDefinition.EditorTemplate>
the RadWatermarkTextBox status is not readonly, when set the PropertyDefinition isreadonly true
what is the reason for this?