title | author | description | keywords |
---|---|---|---|
BindableValueHolder |
nmetulev |
The BindableValueHolder lets users change several objects' states at a time. |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, BindableValueHolder |
The BindableValueHolder lets users change several objects' states at a time.
<helpers:BindableValueHolder x:Name="BindName" Value="{StaticResource BindValue}" />
Property | Type | Description |
---|---|---|
Value | object | Gets or sets the held value |
You can use it to switch several object states by declaring it as a Resource (either in a page or control):
<helpers:BindableValueHolder x:Name="HighlightBrushHolder" Value="{StaticResource BlackBrush}" />
and using it like that:
<TextBlock x:Name="Label" Foreground="{Binding Value, ElementName=HighlightBrushHolder}" />
<TextBox x:Name="Field" BorderBrush="{Binding Value, ElementName=HighlightBrushHolder}" />
and switching it like that:
<VisualStateGroup x:Name="HighlightStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Wrong">
<VisualState.Setters>
<Setter Target="HighlightBrushHolder.Value" Value="{StaticResource RedBrush}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Device family | Universal, 10.0.16299.0 or higher |
---|---|
Namespace | Microsoft.Toolkit.Uwp.UI |
NuGet package | Microsoft.Toolkit.Uwp.UI |