Back to Devexpress

SankeyDiagramControl.SelectedItemsChanging Event

windowsforms-devexpress-dot-xtracharts-dot-sankey-dot-sankeydiagramcontrol-98b945a0.md

latest5.5 KB
Original Source

SankeyDiagramControl.SelectedItemsChanging Event

Occurs after a user changes the Sankey selection state and before the SelectedItems collection is changed.

Namespace : DevExpress.XtraCharts.Sankey

Assembly : DevExpress.XtraCharts.v25.2.UI.dll

NuGet Package : DevExpress.Win.Charts

Declaration

csharp
public event SankeySelectedItemsChangingEventHandler SelectedItemsChanging
vb
Public Event SelectedItemsChanging As SankeySelectedItemsChangingEventHandler

Event Data

The SelectedItemsChanging event's data class is SankeySelectedItemsChangingEventArgs. The following properties provide information specific to this event:

PropertyDescription
ActionReturns an action that is applied to the SelectedItems collection.
CancelIndicates whether the SelectedItemsChanging event should be canceled.
NewLinksReturns newly selected Sankey links.
NewNodesReturns newly selected Sankey nodes.
OldLinksReturns previously selected Sankey links.
OldNodesReturns previously selected Sankey nodes.

Remarks

Use the e.Cancel property to conditionally cancel the Sankey element selection. The e.NewNodes and e.NewLinks properties contain newly selected nodes and links respectively.

The following example prevents the France node selection:

csharp
private void sankeyDiagramControl1_SelectedItemsChanging(object sender, SankeySelectedItemsChangingEventArgs e) {
  foreach (SankeyNode node in e.NewNodes) {
    if (node.Tag == "France") {
        e.Cancel = true;
    }    
  }
}
vb
Private Sub sankeyDiagramControl1_SelectedItemsChanging(ByVal sender As Object, ByVal e As SankeySelectedItemsChangingEventArgs)
  For Each node As SankeyNode In e.NewNodes
    If node.Tag Is "France" Then
        e.Cancel = True
    End If
  Next
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SelectedItemsChanging 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.

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/SankeyChart/SankeyItemControlProvider.cs#L33

csharp
sankey.ToolTipController = toolTipController;
sankey.SelectedItemsChanging += Sankey_SelectedItemsChanging;
sankey.HighlightedItemsChanged += Sankey_HighlightedItemsChanged;

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/SankeyChart/SankeyItemControlProvider.vb#L39

vb
sankey.ToolTipController = toolTipController
AddHandler sankey.SelectedItemsChanging, AddressOf Sankey_SelectedItemsChanging
AddHandler sankey.HighlightedItemsChanged, AddressOf Sankey_HighlightedItemsChanged

See Also

SelectedItemsChanged

SelectedItems

SankeyDiagramControl Class

SankeyDiagramControl Members

DevExpress.XtraCharts.Sankey Namespace