wpf-devexpress-dot-xpf-dot-charts-dot-heatmap-dot-heatmapcontrol-5de43429.md
Gets or sets the selection mode for heatmap cells.
Namespace : DevExpress.Xpf.Charts.Heatmap
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
[NonCategorized]
public ElementSelectionMode SelectionMode { get; set; }
<NonCategorized>
Public Property SelectionMode As ElementSelectionMode
| Type | Description |
|---|---|
| ElementSelectionMode |
A value that identifies the selection mode.
|
Available values:
| Name | Description | Image |
|---|---|---|
| None |
A user cannot select heatmap cells.
| | | Single |
A user can select a single heatmap cell.
|
| | Multiple |
A user can select multiple heatmap cells.
|
| | Extended |
A user can select a single heatmap cell. A user can hold down the Ctrl key to select multiple cells.
|
|
The following example shows how to use heatmap selected cell data as a source for another chart:
<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] };
}
//...
}
Public Class InteractionViewModel
Inherits DevExpress.Mvvm.BindableBase
'...
Private ReadOnly salesField As System.Collections.Generic.List(Of TreeMapDemo.ProductSale)
Private selectedSalesField As System.Collections.ObjectModel.ObservableCollection(Of Object)
Public ReadOnly Property Sales As List(Of TreeMapDemo.ProductSale)
Get
Return Me.salesField
End Get
End Property
Public Overridable Property SelectedSales As ObservableCollection(Of Object)
Get
Return Me.selectedSalesField
End Get
Set(ByVal value As ObservableCollection(Of Object))
If Me.selectedSalesField Is value Then Return
Me.selectedSalesField = value
If Me.selectedSalesField IsNot Nothing Then AddHandler Me.selectedSalesField.CollectionChanged, Sub(s, e) Me.RaisePropertyChanged("SelectedSales")
Me.RaisePropertyChanged("SelectedSales")
End Set
End Property
Protected Sub New()
Me.salesField = Me.LoadData()
Me.SelectedSales = New System.Collections.ObjectModel.ObservableCollection(Of Object)() From {Me.salesField(0)}
End Sub
' ...
End Class
For a complete source code, see the Selection demo:
See Also