when i am right click over an UltraListView Item, i need to get that item selected.
i ve got the item through MouseDown Event by ItemFromPoint(e.x,e.y)
But there is no Property called "Selected" to true.
ulvMethodsList.Items[2].-----???
private
void ulvWebMethods_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
Point cursorPos = new Point(e.X, e.Y);
UltraListView listView = sender as UltraListView;
if (itemAtPoint != null)
this.ulvMethodsList.ContextMenuStrip = null;
else
this.ulvMethodsList.ContextMenuStrip = cmsListViewStyle;
}
Kindly reply if u ve any solutionto select the item by default while i right click over the ListView in Infragistics.
kkk friends got solution...
if
(e.Button == MouseButtons.Right)
// Change this to false if you want to maintain
// the existing selection.
bool clearExisting = false;
// Use the UltraListView's 'ItemFromPoint' method to hit test for an
// UltraListViewItem. Note that we specify true for the 'selectableAreaOnly'
// parameter, so that we only get a hit when the cursor is over the text
// or image area of the item.
UltraListViewItem itemAtPoint = listView.ItemFromPoint(cursorPos, true);
// If we got a reference to an item, populate the context menu
// accordingly and return
Infragistics.Win.
ISelectionManager selectionManager = listView as Infragistics.Win.ISelectionManager;
selectionManager.SelectItem(itemAtPoint,
true);
itemAtPoint.Activate();
Any way thanks for your reply...
Happy Programming...:) :)
hi,
Actually my problem is when i right click over an listview item, i need to get selected that item.
Depending upon the item,i ll show the context menu appropriate to that.
ex:
Consider there are 10 items in the view.
i have selected the first item through the left mouse click..ok. then when i move the cursor over the 10th item and right click ( not left click ) over that item,i need to get selected that 10 th item and also depends upon the item property i need to show up the context menu.
Identified my problem...!!!
Provide me the solution as far as possible...
this.ulvMethodsList.SelectedItems.Add( this.ulvMethodsList.Items[2] );