Skip to main content
All docs
V24.2

HeatmapControl.SelectedItems Property

Gets or sets heatmap cells or source objects that are used to create the selected cells.

Namespace: DevExpress.Xpf.Charts.Heatmap

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

Declaration

[NonCategorized]
public IList SelectedItems { get; set; }

Property Value

Type Description
IList

A list of objects that store cell data.

Remarks

If the heatmap is bound to a data source, the SelectedItems property returns the data objects assigned to the selected cells. Otherwise, the selected cell objects are returned.

Use the HeatmapControl.SelectedItem property to obtain the last selected cell.

Example

The following example shows how to use heatmap selected cell data as a source for another chart:

Selection demo

<dxh:HeatmapControl x:Name="heatmap" 
                    Grid.Row="0" Margin="10" 
                    SelectionMode="Multiple"
                    SelectedItems="{Binding SelectedSales, Mode=TwoWay}" 
                    ToolTipEnabled="True">
    <dxh:HeatmapDataSourceAdapter
        DataSource="{Binding Sales}"
        XArgumentDataMember="Month"
        YArgumentDataMember="Product"
        XArgumentComparer="{local:SaveOrderComparer}"
        ColorDataMember="RevenueByMonth"/>
        <!--...-->
</dxh:HeatmapControl>

<dxc:ChartControl x:Name="chart" Grid.Row="1"
    DataSource="{Binding SelectedSales, Converter={local:SelectedItemsToDataSourceConverter}}" 
    BorderBrush="Transparent">
    <!--...-->
</dxc:ChartControl>
public class InteractionViewModel : BindableBase {
    //...

    readonly List<ProductSale> sales;
    ObservableCollection<object> selectedSales;

    public List<ProductSale> Sales { get { return sales; } }
    public virtual ObservableCollection<object> SelectedSales {
        get { return selectedSales; }
        set {
            if (selectedSales == value)
                return;
            selectedSales = value;
            if (selectedSales != null)
                selectedSales.CollectionChanged += (s, e) => RaisePropertyChanged("SelectedSales");
            RaisePropertyChanged("SelectedSales");
        }
    }
    protected InteractionViewModel() {
        sales = LoadData();
        SelectedSales = new ObservableCollection<object>() { sales[0] };
    }
    //...
}

For a complete source code, see the Selection demo:

Run Demo

See Also