CustomStatePresentation.StateTemplate Property
Gets or sets a template that configures the state appearance. This is a dependency property.
Namespace: DevExpress.Xpf.Gauges
Assembly: DevExpress.Xpf.Gauges.v24.1.dll
NuGet Package: DevExpress.Wpf.Gauges
Declaration
Property Value
Type | Description |
---|---|
ControlTemplate | A control template that specifies the state visual structure. |
Example
This example demonstrates how to define a custom state indicator’s state presentation.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GaugesDemoApp"
xmlns:dxga="http://schemas.devexpress.com/winfx/2008/xaml/gauges"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
x:Class="GaugesDemoApp.MainWindow"
Title="MainWindow" Height="350" Width="300">
<Grid>
<StackPanel Orientation="Vertical">
<dxga:StateIndicatorControl Foreground="White" StateIndex="{Binding ElementName=tbeStateIndex, Path=Value}">
<dxga:StateIndicatorControl.AdditionalStates>
<dxga:State>
<dxga:State.Presentation>
<dxga:CustomStatePresentation>
<dxga:CustomStatePresentation.StateTemplate>
<ControlTemplate>
<Viewbox>
<Border Background="Black">
<TextBlock Text="$"/>
</Border>
</Viewbox>
</ControlTemplate>
</dxga:CustomStatePresentation.StateTemplate>
</dxga:CustomStatePresentation>
</dxga:State.Presentation>
</dxga:State>
<dxga:State>
<dxga:State.Presentation>
<dxga:CustomStatePresentation>
<dxga:CustomStatePresentation.StateTemplate>
<ControlTemplate>
<Viewbox>
<Border Background="Black">
<TextBlock Text="¥"/>
</Border>
</Viewbox>
</ControlTemplate>
</dxga:CustomStatePresentation.StateTemplate>
</dxga:CustomStatePresentation>
</dxga:State.Presentation>
</dxga:State>
<dxga:State>
<dxga:State.Presentation>
<dxga:CustomStatePresentation>
<dxga:CustomStatePresentation.StateTemplate>
<ControlTemplate>
<Viewbox>
<Border Background="Black">
<TextBlock Text="£"/>
</Border>
</Viewbox>
</ControlTemplate>
</dxga:CustomStatePresentation.StateTemplate>
</dxga:CustomStatePresentation>
</dxga:State.Presentation>
</dxga:State>
<dxga:State>
<dxga:State.Presentation>
<dxga:CustomStatePresentation>
<dxga:CustomStatePresentation.StateTemplate>
<ControlTemplate>
<Viewbox>
<Border Background="Black">
<TextBlock Text="€"/>
</Border>
</Viewbox>
</ControlTemplate>
</dxga:CustomStatePresentation.StateTemplate>
</dxga:CustomStatePresentation>
</dxga:State.Presentation>
</dxga:State>
</dxga:StateIndicatorControl.AdditionalStates>
</dxga:StateIndicatorControl>
<dxe:TrackBarEdit Minimum="0" Maximum="3" TickFrequency="1" Height="20" Width="100" x:Name="tbeStateIndex"/>
</StackPanel>
</Grid>
</Window>
The image below illustrates the result.
See Also