Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Problem in UltraGird Row selection
posted

Hi,

When my grid is displayed on the screen a row seems to be selected. I have added a context menu to grid and i want the row at which the mouse is pointing out to get selected.

 I am using the following code:

private

 

 

void ultraGrid1_MouseDown(object sender, MouseEventArgs e)

{

UltraGridRow

 

 

row;  

UIElement element;

 if (e.Button == MouseButtons.Right)

element = ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(e.Location);

row = element.GetContext(typeof(UltraGridRow)) as UltraGridRow;

 

if(row != null && row.IsDataRow) row.Selected = true;

{

ultraGrid1.Selected.Rows.Clear();

 

 

}

}

Now, the problem is the row which seemed to be selected earlier is still selected and the new row is also selected. The problem also occurs when I selects a row to edit and then right click on any other row.