Contents
- SelectionChanging Event
- SelectionChanged Event
Having trouble getting help?
Contact Support
Contact Support
Selection in Windows Forms Tree Navigator
29 Apr 20213 minutes to read
The selected item of the current hierarchy level is get/set through SelectedItem property.
The following code examples allow you to set the SelectedItem.
//To set the selected item in the Tree navigator.
this.treeNavigator1.SelectedItem = treeMenuItem3;
‘To set the selected item in the Tree navigator.
Me.treeNavigator1.SelectedItem = treeMenuItem3
SelectionChanging Event
This event is triggered before the selection of the tree menu item changes.
Event Data
SelectionStateChangingEventArgs contains the following members that provide information specific to this event.
Members |
Description |
---|---|
NewValue |
This property returns the newly selected item. |
OldValue |
This property returns the previously selected item. |
Extended |
This property returns true when the selected item is expanded. |
Cancel |
This property enables you to avoid particular item from Selection. |
void treeNavigator1_SelectionChanging(TreeNavigator sender, SelectionStateChangingEventArgs args)
{
args.Cancel = true;
TreeMenuItem item = args.NewValue;
TreeMenuItem OldItem = args.OldValue;
bool temp = args.Expanded;
}
Private Sub treeNavigator1_SelectionChanging(sender As TreeNavigator, args As SelectionStateChangingEventArgs)
args.Cancel = True
Dim item As TreeMenuItem = args.NewValue
Dim OldItem As TreeMenuItem = args.OldValue
Dim temp As Boolean = args.Expanded
End Sub
SelectionChanged Event
This event is triggered after the selection of the tree menu item changes.
Event Data
SelectionStateChangedEventArgs contains the following members that provide information specific to this event.
Members |
Description |
---|---|
SelectedItem |
This property returns the currently selected item. |
Expanded |
This property returns true when the selected item is expanded. |
</table>
|