Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Bind CollectionControl isEnabled property and style

$
0
0
Hi,

You can set a style on the PropertyGridEditorDoubleUpDown and use a trigger to change the color when IsReadOnly is true.
<Window.Resources>      
      <Style x:Key="DoubleUpDownStyle"
             TargetType="{x:Type xctk:PropertyGridEditorDoubleUpDown}">
         <Setter Property="TextAlignment"
                 Value="Left" />
         <Setter Property="Foreground"
                 Value="Green" />
         <Style.Triggers>
            <DataTrigger Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Self}}"
                         Value="True">
               <Setter Property="Foreground"
                       Value="Red" />
            </DataTrigger>
         </Style.Triggers>
      </Style>
</Window.Resources>

....

<xctk:PropertyGrid x:Name="_propertyGrid">
         <xctk:PropertyGrid.EditorDefinitions>
            <xctk:EditorTemplateDefinition TargetProperties="UConstruction">
               <xctk:EditorTemplateDefinition.EditingTemplate>
                  <DataTemplate>
                     <xctk:PropertyGridEditorDoubleUpDown Value="{Binding Value}"
                                                          IsReadOnly="{Binding Instance.IsUYConstruction}"
                                                          Style="{StaticResource DoubleUpDownStyle}"/>
                  </DataTemplate>
               </xctk:EditorTemplateDefinition.EditingTemplate>
            </xctk:EditorTemplateDefinition>
         </xctk:PropertyGrid.EditorDefinitions>
</xctk:PropertyGrid>

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>