Any UIElement
can be embedded and precisely placed inside any of the gauge controls.
Adding/Removing UIElements
UIElement
objects can be added or removed from the gauge controls using the Items collection property.
This code shows how a TextBlock
can be added to a Digital
Positioning UIElements
By default, UIElement
objects will be centered in the associated gauge control, but it's position can be specified using the XProperty, YProperty, Origin
Continuing from the example above, this code shows how the TextBlock
can be positioned 10-pixels to the right and 10-pixels down from the top-left corner:
See the Coordinate System topic for more information on positioning controls, including setting the z-index.
The gauge controls use the HorizontalAlignment
and VerticalAlignment
properties of FrameworkElement
-derived objects to further control the positioning. The tables below describe the behavior used for the various alignment values.
HorizontalAlignment | Description |
---|---|
Center |
Indicates that the center of the FrameworkElement will be aligned with the point specified along the X-axis. This is the default alignment and is always used for non-FrameworkElement -derived objects. |
Left |
Indicates that the left side of the FrameworkElement will be aligned with the point specified along the X-axis. |
Right |
Indicates that the right side of the FrameworkElement will be aligned with the point specified along the X-axis. |
Stretch |
See Center . |
VerticalAlignment | Description |
---|---|
Bottom |
Indicates that the bottom side of the FrameworkElement will be aligned with the point specified along the Y-axis. |
Center |
Indicates that the center of the FrameworkElement will be aligned with the point specified along the Y-axis. This is the default alignment and is always used for non-FrameworkElement -derived objects. |
Top |
Indicates that the top side of the FrameworkElement will be aligned with the point specified along the Y-axis. |
Stretch |
See Center . |