Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
  • EO.WebBrowser
  • EO.Wpf
    • Overview
    • Installation & Deployement
    • Skin & Theme
    • Common Taskes and Services
    • EO.Wpf Buttons
    • EO.Wpf Calendar & DatePicker
    • EO.Wpf ComboBox
    • EO.Wpf DockView
    • EO.Wpf Gauge
    • EO.Wpf ListBox
    • EO.Wpf Menu
    • EO.Wpf MaskedEdit
    • EO.Wpf ProgressBar
    • EO.Wpf Slider
    • EO.Wpf SpinEdit
    • EO.Wpf SplitView
    • EO.Wpf TabControl
    • EO.Wpf TreeView
    • EO.Wpf Utility Controls
    • EO.Wpf WindowChrome
    • Sample Data Objects
  • Common Topics
  • Reference
Shape & Label

A tick bar is an ItemsControl, so you can use it the same way as you use any other ItemsControl. For example, by default a LinearTickBar control displays the corresponding value at each tick position. You can use ItemTemplate property to customize it to display a vertical bar:

XAML
<eo:LinearTickBar Minimum="0" Maximum="10" MinorInterval="1" TicksDisplay="Minor">
    <eo:LinearTickBar.ItemTemplate>
        <DataTemplate>
            <Rectangle Width="1" Height="10" Fill="Black"></Rectangle>
        </DataTemplate>
    </eo:LinearTickBar.ItemTemplate>
</eo:LinearTickBar>

The above code renders a Rectangle at each tick position and produces the following result:

While theoretically ItemTemplate can contain anything, for a gauge control it usually either contain a text label such as number values, or a shape, such as a line, a dots, etc. For this reason, All EO.Wpf tickbar controls recognize two special names inside its ItemTemplate:

Control Name Remark
PART_Label Must be a Label control. When this control is present in the tick bar's ItemTemplate, the tick bar automatically applies LabelStyle and LabelFormatString to that control.
PART_Shape Must be a Shape control. When this control is present in the tick bar's ItemTemplate, the tick bar automatically applies ShapeStyle to that control.

For example, the following XAML code generates the same result as the above sample:

XAML
<eo:LinearTickBar Minimum="0" Maximum="10" MinorInterval="1" TicksDisplay="Minor">
    <eo:LinearTickBar.ItemTemplate>
        <DataTemplate>
            <Rectangle x:Name="PART_Shape"></Rectangle>
        </DataTemplate>
    </eo:LinearTickBar.ItemTemplate>
    <eo:LinearTickBar.ShapeStyle>
        <Style TargetType="Shape">
            <Setter Property="Width" Value="1"></Setter>
            <Setter Property="Height" Value="10"></Setter>
            <Setter Property="Fill" Value="Black"></Setter>
        </Style>
    </eo:LinearTickBar.ShapeStyle>
</eo:LinearTickBar>

In this sample, a Shape (Rectangle) with name "PART_Shape" exists in the ItemTemplate, so the LinearTickBar control automatically applies its ShapeStyle to that Rectangle.

The following sample demonstrates how to use LabelFormatString:

XAML
<eo:LinearTickBar Minimum="0" Maximum="1" MinorInterval="0.1" TicksDisplay="Minor" LabelStringFormat="0.0">
    <eo:LinearTickBar.ItemTemplate>
        <DataTemplate>
            <Label Name="PART_Label" Content="{Binding}"></Label>
        </DataTemplate>
    </eo:LinearTickBar.ItemTemplate>
</eo:LinearTickBar>

Key points in this sample include:

  • ItemTemplate contains a Label whose name is PART_Label;
  • The Label's Content is set to {Binding}, which takes the tick value;
  • The LinearTickBar's LabelStringFormat is set to "0.0", which formats the tick value with one decimal digit.

The above sample generates the following result:

RollingTickBar is very similar to a LinearTickBar, except that a RollingTickBar only displays a portion of the full value range. See Using RollingScale for more information about this difference.