SymbolSegmentsMapping.SegmentsStates Property
Specifies appropriate segment states for a desired character.
Namespace: DevExpress.Xpf.Gauges
Assembly: DevExpress.Xpf.Gauges.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
StatesMask | A StatesMask value that specifies segments states. |
Remarks
To activate corresponding segments for displaying a custom symbol (specified by the SymbolSegmentsMapping.Symbol property), set their states using the SegmentsStates property to 1.
Note that the DigitalGaugeControl.Text property also should contain a custom symbol.
Example
This example demonstrates how to display custom characters on a DigitalGaugeControl. This is done via the Custom Symbol Mapping feature that defines which segments should be activated for every custom character.
In this sample we will display “HELLO.” using the 7 Segment View type. Note that, by default, these characters can’t be displayed in this view (because 7 segments are not enough to provide unique representations for all Latin characters), but some characters can be efficiently displayed via custom symbol mapping.
For this, it is necessary to use the SymbolSegmentsMapping.SegmentsStates
property to specify appropriate segment states for every desired character. In our case, these will be the following characters: “H”, “E”, “L”, “O”, “.” Note that for the dot character, we set the SymbolSegmentsMapping.SymbolType property value to Additional, so that it will be displayed in the same segment with the previous character.
Then, we specify the text that should be displayed on the segments panel via the DigitalGaugeControl.Text property.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-use-custom-symbol-mapping-in-the-digital-gauge-control-e3523.
<Window x:Class="CustomSymbolMapping.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxga="http://schemas.devexpress.com/winfx/2008/xaml/gauges"
Title="MainWindow" Height="350" Width="525">
<Grid>
<dxga:DigitalGaugeControl Name="digitalGaugeControl1" Text="HELLO.">
<dxga:DigitalGaugeControl.SymbolView>
<dxga:SevenSegmentsView>
<dxga:SevenSegmentsView.CustomSymbolMapping>
<dxga:SymbolSegmentsMapping Symbol="H" SegmentsStates="0 1 1 0 1 1 1"/>
<dxga:SymbolSegmentsMapping Symbol="E" SegmentsStates="1 0 0 1 1 1 1"/>
<dxga:SymbolSegmentsMapping Symbol="L" SegmentsStates="0 0 0 1 1 1 0"/>
<dxga:SymbolSegmentsMapping Symbol="O" SegmentsStates="1 1 1 1 1 1 0" />
<dxga:SymbolSegmentsMapping Symbol="." SegmentsStates="0 0 0 0 0 0 0 1"
SymbolType="Additional"/>
</dxga:SevenSegmentsView.CustomSymbolMapping>
</dxga:SevenSegmentsView>
</dxga:DigitalGaugeControl.SymbolView>
</dxga:DigitalGaugeControl>
</Grid>
</Window>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SegmentsStates property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.