windowsforms-devexpress-dot-xtracharts-dot-sankey-dot-sankeydiagramcontrol-388c118f.md
Occurs after a user changes the Sankey selection state and this change is applied to the SelectedItems collection.
Namespace : DevExpress.XtraCharts.Sankey
Assembly : DevExpress.XtraCharts.v25.2.UI.dll
NuGet Package : DevExpress.Win.Charts
public event SankeySelectedItemsChangedEventHandler SelectedItemsChanged
Public Event SelectedItemsChanged As SankeySelectedItemsChangedEventHandler
The SelectedItemsChanged event's data class is SankeySelectedItemsChangedEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| SelectedLinks | Returns selected Sankey links. |
| SelectedNodes | Returns selected Sankey nodes. |
The following example uses the SankeySelectedItemsChangedEventArgs.SelectedLinks property to add selected links to a custom selectedExportItems collection:
HashSet<ExportItem> selectedExportItems = new HashSet<ExportItem>();
private void sankeyDiagramControl1_SelectedItemsChanged(object sender, SankeySelectedItemsChangedEventArgs e){
selectedExportItems.Clear();
foreach (SankeyLink link in e.SelectedLinks) {
selectedExportItems.Add((ExportItem)link.Tags[0]);
}
}
//...
public class ExportItem {
public string Exporter { get; set; }
public string Importer { get; set; }
public double Sum { get; set; }
public ExportItem(string from, string to, double weight) {
this.Exporter = from;
this.Importer = to;
this.Sum = weight;
}
}
Private selectedExportItems As HashSet(Of ExportItem) = New HashSet(Of ExportItem)()
Private Sub sankeyDiagramControl1_SelectedItemsChanged(ByVal sender As Object, ByVal e As SankeySelectedItemsChangedEventArgs)
selectedExportItems.Clear()
For Each link As SankeyLink In e.SelectedLinks
selectedExportItems.Add(CType(link.Tags(0), ExportItem))
Next
End Sub
'...
Public Class ExportItem
Public Property Exporter As String
Public Property Importer As String
Public Property Sum As Double
Public Sub New(ByVal from As String, ByVal [to] As String, ByVal weight As Double)
Exporter = from
Importer = [to]
Sum = weight
End Sub
End Class
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SelectedItemsChanged event.
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.
sankey.EmptySankeyText.Text = string.Empty;
sankey.SelectedItemsChanged += Sankey_SelectedItemsChanged;
toolTipController = new ToolTipController();
sankey.EmptySankeyText.Text = String.Empty
AddHandler sankey.SelectedItemsChanged, AddressOf Sankey_SelectedItemsChanged
toolTipController = New ToolTipController()
See Also