バージョン

GetSelectionStrategy メソッド (ISelectionStrategyFilter)

特定の項目のための選択方式を取得するために呼び出されます。null を返すと、コントロールが固有の実装を提供することを意味します。
シンタックス
'宣言
 
Function GetSelectionStrategy( _
   ByVal item As Infragistics.Shared.ISelectableItem _
) As ISelectionStrategy
ISelectionStrategy GetSelectionStrategy( 
   Infragistics.Shared.ISelectableItem item
)

パラメータ

item
選択戦略を決定すべき Infragistics.Shared.ISelectableItem

戻り値の型

指定した項目の ISelectionStrategy またはコントロールが固有の実装を提供する場合は null。
使用例
Imports Infragistics.Win
    Imports Infragistics.Win.UltraWinGrid


' Implement the ISelectionStrategyFilter interface on a class
' (in this case the form)
Public Class Form1
    Inherits System.Windows.Forms.Form
    Implements Infragistics.Win.ISelectionStrategyFilter

    Private cellSelectionStrategy 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.cellSelectionStrategy = New MyCustomSelectionStrategy(Me.UltraGrid1)

        ' Set the grid’s SelectionStrategyFilter property to the object that
        ' implements the ISelectionStrategyFilter interface.
        Me.UltraGrid1.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 cell return the custom strategy
        If TypeOf (item) Is UltraGridCell Then
            Return Me.cellSelectionStrategy
        End If

        ' Return null to have the grid provide an appropriate strategy
        Return Nothing

    End Function
End Class

' derive a class from one of the selection
' strategies defines 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;
	using Infragistics.Win.UltraWinGrid;

// Implement the ISelectionStrategyFilter interface on a class
// (in this case the form)
public class Form1 : 
		System.Windows.Forms.Form, 
		Infragistics.Win.ISelectionStrategyFilter
{

	private ISelectionStrategy cellSelectionStrategy;


	private void Form1_Load(object sender, System.EventArgs e)
	{

		// Set the grid’s SelectionStrategyFilter property to the object that
		// implements the ISelectionStrategyFilter interface.

		this.ultraGrid1.SelectionStrategyFilter = this;

		// Create the custom selection strategy

		this.cellSelectionStrategy = new MyCustomSelectionStrategy( this.ultraGrid1 );

	}

	public Infragistics.Win.ISelectionStrategy GetSelectionStrategy(Infragistics.Shared.ISelectableItem item)
	{

		// If the item is a cell return the custom strategy
		if ( item is UltraGridCell )
			return this.cellSelectionStrategy;

		return null;

	}

	// derive a class from one of the selection
	// strategies defines 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 );

		}
	}
}
参照