Skip to main content
A newer version of this page is available. .

LegendItemContainer Class

Storage for a legend item’s appearance settings.

Namespace: DevExpress.Xpf.Charts

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Charts, DevExpress.Wpf.Charts

Declaration

public class LegendItemContainer :
    DockPanel,
    IHitTestableElement

Remarks

The Chart Control uses this container to lay out a legend item’s children (a marker, text, etc.).

Example

The following markup configures legend items that belong to series:

<dxc:ChartControl.Legends>
    <dxc:Legend HorizontalPosition="Left" 
                VerticalPosition="Top" 
                Orientation="Vertical">
        <dxc:Legend.ItemTemplate>
            <DataTemplate>
                <dxc:LegendItemContainer>
                    <Grid Width="12" Height="12">
                        <Rectangle Stretch="Uniform" 
                                   Fill="Transparent"/>
                        <dxc:ChartContentPresenter Content="{Binding}" 
                                                   ContentTemplate="{Binding Path=MarkerTemplate}"/>
                    </Grid>
                    <TextBlock Text="{Binding Path=Text}" 
                               VerticalAlignment="Center" 
                               MaxWidth="250" 
                               Margin="4"
                               Foreground="{Binding Path=MarkerBrush}"/>
                </dxc:LegendItemContainer>
            </DataTemplate>
        </dxc:Legend.ItemTemplate>
    </dxc:Legend>
</dxc:ChartControl.Legends>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LegendItemContainer class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also