Back to Devexpress

RangeControl.LabelTemplate Property

wpf-devexpress-dot-xpf-dot-editors-dot-rangecontrol-dot-rangecontrol-5c9dfe54.md

latest2.7 KB
Original Source

RangeControl.LabelTemplate Property

Gets or sets the DataTemplate used to render the built-in labels that indicate the bound values of the selected range.

Namespace : DevExpress.Xpf.Editors.RangeControl

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public DataTemplate LabelTemplate { get; set; }
vb
Public Property LabelTemplate As DataTemplate

Property Value

TypeDescription
DataTemplate

A DataTemplate object used to render the bound labels.

|

Remarks

The LabelTemplate property allows you to specify a DataTemplate used to render the built-in labels. Label visibility can be specified with the RangeControl.ShowLabels property.

Example

The following example shows how to declare a custom data template that renders the bound labels as TextBlocks.

In this example, the DataTemplate is assigned to the RangeControl.LabelTemplate property. This DataTemplate contains the TextBlock control which specifies the text attributes.

The following image shows the result.

xaml
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"

<Window.Resources>
    <DataTemplate x:Key="labelTemplate">
        <TextBlock FontFamily="Segoe UI"
                   FontSize="12" 
                   FontWeight="Bold"
                   Foreground="Black" 
                   Background="Orange"
                   VerticalAlignment="Center"
                   Padding="10" 
                   Text="{Binding}"/>
    </DataTemplate>
</Window.Resources>

...

<dxe:RangeControl Name="rangeControl1" 
                  LabelTemplate="{StaticResource ResourceKey=labelTemplate}">
...
</dxe:RangeControl>

See Also

ShowLabels

DataTemplate

RangeControl Class

RangeControl Members

DevExpress.Xpf.Editors.RangeControl Namespace