ColorLegend.ItemTemplate Property

Gets or sets the template that specifies the visual representation of the legend's items.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v20.1.dll

Declaration

public DataTemplate ItemTemplate { get; set; }
Public Property ItemTemplate As DataTemplate

Property Value

Type Description
DataTemplate

The DataTemplate object that specifies the visual representation of the legend's items.

Examples

This example demonstrates how to customize a map legend's items using the legend's ColorLegend.ItemTemplate and MapLegendBase.ItemLabelTemplate properties. The legend uses these templates to create visual representations of a legend's items and legend item labels.

Note that templates use the MapLegendItemBase and its descendant classes' objects as the DataContext property value.

<dxm:ColorListLegend Layer="{Binding ElementName=vectorLayer}"
                     Header="GDP">
    <dxm:ColorListLegend.ItemTemplate>
        <DataTemplate>
            <StackPanel Margin="4,2,4,2" 
                        Orientation="Horizontal" >
                <Ellipse Width="16" 
                         Height="16" 
                         Fill="{Binding Fill}"/>
                <ContentControl Margin="8, 0, 0, 0" 
                                Content="{Binding}" 
                                ContentTemplate="{Binding Path=LabelTemplate}"/>
            </StackPanel>
        </DataTemplate>
    </dxm:ColorListLegend.ItemTemplate>
    <dxm:ColorListLegend.ItemLabelTemplate>
        <DataTemplate>
            <TextBlock Height="16" 
                       VerticalAlignment="Center"
                       Text="{Binding Value, Converter={StaticResource valueConverter}}"/>
        </DataTemplate>
    </dxm:ColorListLegend.ItemLabelTemplate>
</dxm:ColorListLegend>
See Also