Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The BindableValueHolder lets users change several objects' states at a time.
Syntax
<helpers:BindableValueHolder x:Name="BindName" Value="{StaticResource BindValue}" />
Properties
| Property | Type | Description |
|---|---|---|
| Value | object | Gets or sets the held value |
Example
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>
Requirements
| Device family | Universal, 10.0.16299.0 or higher |
|---|---|
| Namespace | Microsoft.Toolkit.Uwp.UI |
| NuGet package | Microsoft.Toolkit.Uwp.UI |