Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
XamPropertyGrid: ReadOnly-Opacity of a Property
posted

Hi

I have a XamPropertyGrid-Control with an ReadOnlyTemplate. The Opacity of the ReadOnly-Property seems to be smaller than 1. How can I set it to 1? 

<ig:PropertyGridEditorDefinition
TargetType="{x:Type sys:Double}"
EditTemplate="{StaticResource SpinIntEditor}"
ReadOnlyTemplate="{StaticResource IntEditorRO}"/>

<DataTemplate x:Key="IntEditorRO">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image x:Name="errorImage" Width="16" Height="16" Margin="2" Grid.Column="0" DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ig:XamPropertyGrid}}}" Visibility="Hidden"> </Image>
<TextBox MinWidth="20" Grid.Column="1" Margin="2" Text="{Binding Path=Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
</TextBox>
</Grid>
</DataTemplate>

Regards, Stephan

Parents
No Data
Reply
  • 980
    Offline posted

    Hello Stephan,

    XamPropertyGrid uses MaskedInput and DateTimeInput to display fields. Both of these inputs are configured so when the property is readonly/disabled, they will change the opacity of the embedded MaskedInputTextBox.

    In order to modify this behavior, you will have to get the default styles of the Inputs(maybe not needed to have both, depends on what fields you intend to style), as well as the grid itself, and modify them accordingly.

    You can check the following forum thread  where you can find a sample for the same behavior affecting date fields. The approach will be the same, with the only difference your current data template is modified by the MaskedInput - 

    C:\Program Files (x86)\Infragistics\<version>\WPF\DefaultStyles\MaskedInput\generic.shared.xaml 

    Please let me know if you have any issues following the steps described in the other post by my colleague.

    Sincerely,

    Tihomir Tonev
    Associate Software Developer
    Infragistics

Children