'Declaration Public Property SelectionStrategyFilter As Infragistics.Win.ISelectionStrategyFilter
public Infragistics.Win.ISelectionStrategyFilter SelectionStrategyFilter {get; set;}
Imports Infragistics.Win.UltraWinTree Public Class Form1 Inherits System.Windows.Forms.Form Implements Infragistics.Win.ISelectionStrategyFilter Private nodeSelectionStrategy As MyCustomSelectionStrategy Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' create the custom selection strategy Me.nodeSelectionStrategy = New MyCustomSelectionStrategy(Me.ultraTree1) ' Set the tree control's SelectionStrategyFilter ' property to the object that implements the ' ISelectionStrategyFilter interface (in this ' case this form). Me.ultraTree1.SelectionStrategyFilter = Me End Sub Public Function GetSelectionStrategy(ByVal item As Infragistics.Shared.ISelectableItem) As Infragistics.Win.ISelectionStrategy Implements Infragistics.Win.ISelectionStrategyFilter.GetSelectionStrategy ' If the item is a node return the custom strategy If TypeOf (item) Is UltraTreeNode Then Return Me.nodeSelectionStrategy End If ' Return nothing to have the tree provide an appropriate strategy Return Nothing End Function End Class ' Derive a class from one of the selection ' strategies defined in the PLF Friend Class MyCustomSelectionStrategy Inherits Infragistics.Win.SelectionStrategyExtended Public Sub New(ByVal manager As ISelectionManager) MyBase.New(manager) End Sub Public Overloads Overrides Function OnMouseDown(ByVal item As Infragistics.Shared.ISelectableItem, ByRef msginfo As Infragistics.Win.MouseMessageInfo) As Boolean ' do some custom mouse down processing ' ... Return MyBase.OnMouseDown(item, msginfo) End Function End Class
using System.Diagnostics; using Infragistics.Win.UltraWinTree; public class Form1 : System.Windows.Forms.Form, Infragistics.Win.ISelectionStrategyFilter { private MyCustomSelectionStrategy nodeSelectionStrategy; private void Form1_Load(object sender, System.EventArgs e) { // create the custom selection strategy this.nodeSelectionStrategy = new MyCustomSelectionStrategy(this.ultraTree1 ); // Set the tree control’s SelectionStrategyFilter // property to the object that implements the // ISelectionStrategyFilter interface (in this // case the this form). this.ultraTree1.SelectionStrategyFilter = this; } public Infragistics.Win.ISelectionStrategy GetSelectionStrategy(Infragistics.Shared.ISelectableItem item) { // If the item is a node return the custom strategy if ( item is UltraTreeNode ) return this.nodeSelectionStrategy; // Return null to have the tree provide an appropriate strategy return null; } } // Derive a class from one of the selection // strategies defined in the PLF internal class MyCustomSelectionStrategy : SelectionStrategyExtended { internal MyCustomSelectionStrategy( ISelectionManager manager ) : base( manager ) { } public override bool OnMouseDown(Infragistics.Shared.ISelectableItem item, ref Infragistics.Win.MouseMessageInfo msginfo) { // do some custom mouse down processing // ... return base.OnMouseDown( item, ref msginfo ); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2