UXTickBar uses the value of Minimum, Maximum, and LargeChange properties to calculate the number of tickbar items to be displayed.
The following example shows how to create a tick bar that renders five tickbar items that starts from 2 and ends at 10. The value of LargeChange property determines the position where each tickbar item will be rendered with respect of Minimum and Maximum value.
By default, as you can see in the above figure, the content of each tickbar item is generated automatically. Alternatively, you can specify custom content for each tick bar item by specifying the Items collection. Note that the number of items will still be determined by Minimum, Maximum, and LargeChange properties. This means, in order to achieve the same layout, you need to specify the same number of tickbar items with custom content.
The following example shows how to create a tick bar with custom content for each tick bar item.
UXTickBar is an items control that derives from ISItemsControl class, which means that UXTickBar can contain and display a collection of objects. You can display a collection of UIElement through the Items property, or a collection of data entity through the ItemsSource property. When UXTickBar is bound to a collection of data entity, the tickbar item will not be generated automatically. The tickbar item will be considered as tickbar item with custom content.
The item container type of UXTickBar is UXTickBarItem. Each UXTickBarItem contains a pointer element and a content element. The content of each tickbar item is not restricted to string type only. You can specify other UIElement as the content of UXTickBarItem. Besides that, you can choose to show either the pointer or content element only using PointerVisibility and ContentVisibility properties.
The following example shows how to hide pointer element in UXTickBar.
The following example shows how to hide content element in UXTickBar.
Customizing Pointer Appearance
By default, the width and height of the pointer element is 1 pixel and 5 pixel respectively. You can simply customize the size of the pointer element using PointerWidth and PointerHeight properties. Besides that, the pointer can be positioned to Top, Left, Bottom, or Right using PointerPosition property.
You can use PointerTemplate to fully customize the appearance of the pointer. For more information on how to customize the pointer appearance using PointerTemplate, see How-to: Customize Pointer Element in UXTickBar.
Customizing Tick Content Format String
When the tickbar items are generated automatically, UXTickBar will use the value of each tickbar item as the content of the item. You can set the format string of tickbar items' content using TickFormat property. You can apply the standard numeric format string to the content of the tickbar item. For more information on standard numeric format string, see Standards Numeric Format Strings.
The following example shows how to apply one digit decimal format string to the tickbar items.
Customizing UXTickBar Appearance
You can customize the appearance of UXTickBar using the following properties:
- Orientation and IsDirectionReversed
You can specify the orientation of UXTickBar to Horizontal or Vertical using Orientation property. In horizontal UXTickBar, the tick bar items will be displayed from left to right. In vertical UXTickBar, the tick bar items will be displayed from bottom to top. Alternatively, you can set IsDirectionReversed property to reverse the direction of the increasing value. If IsDirectionReversed property is set to True, the tick bar items will be displayed from right to left in horizontal UXTickBar and from top to bottom in vertical UXTickBar.
The following example shows how to set the position of the pointer in UXTickBar.
Configuring TickBar Item Display
By default, all tickbar items will be displayed in the calculated position based on the number of tickbar items and the available rendered area. In some cases, you might need to show some tickbar items and hide the others. In this case, you can specify which tickbar items to be displayed using Ticks property. For example, if you set Ticks property to 1, 5, 7, then the first, fifth, and seventh tickbar items will be displayed and the other tickbar items will be hidden.