
I'm using implicit styles in my propgrid and I have some cases where I want the style of one property dependent on another property. I see in the quick starts how this can be done in the view model by exposing properties and binding them (with associated NotifyPropertyChange, etc) but I'd like to keep this in the xaml (my view model classes are dynamically generated so adding logic using the MethodBulder, etc. is harder).
I see examples where logic is bound to an ancestor in the visual model but can I bind to a sibling property? (I know the property name and display name of the sibling)
Some examples of cases I'd like to support:
- bind readonly/background color of one property based on IsSelected value of another checkbox property (using the built-in editor/CheckBoxValueTemplateKey template)
- bind readonly/background color of one property based on selected item value of a sibling combobox bound to an enumerated type
Here's an incomplete example:
<Style TargetType="propgrid:PropertyGridDataAccessorItem">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding DataAccessorType, RelativeSource={RelativeSource Self}}" Value="Property" />
<Condition Binding="{Binding ValueName, RelativeSource={RelativeSource Self}}" Value="Address2" />
<Condition Binding="{Binding IsSelected, What goes here? }" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="propgrid:PropertyGrid.IsReadOnly" Value="True" />
<Setter Property="Background" Value="LightGray"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
Sorry if this is a basic xaml binding question but I have a lot to learn in that area!
Regards,
Tom