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 MyCustomSelectionStrategy cellSelectionStrategy;
private void Form1_Load(object sender, System.EventArgs e)
{
// create the custom selection strategy
this.cellSelectionStrategy = new MyCustomSelectionStrategy(this.ultraGrid1);
// Set the grid's SelectionStrategyFilter property to the object that
// implements the ISelectionStrategyFilter interface.
this.ultraGrid1.SelectionStrategyFilter = this;
}
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 to have the grid provide an appropriate strategy
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);
}
}