I have Navigation bar control and one NavBar
Group contains the grid control. I want to get the single click event on particular image which is in one column of grid control and on image click event I have to show the pop-up for some menu options.
I’m using the grid control’s preview mouse left button up event to get the click but it’s not working because the grid control resides in Navbar
control.
Basically my problem is that I am not able to get the single click on image which is on column of grid control and grid column itself resides in one Navbar
group of NavBar
Control.
This link has my demo project.
Any help will be appreciated.
I have seen your demo project and i think the below code will solve your problem:-
private void gridControl1_PreviewMouseDown(object sender, MouseButtonEventArgs e) {
TableViewHitInfo hit = tableView1.CalcHitInfo(e.OriginalSource as DependencyObject);
if (hit.InRowCell) {
gridControl1.View.FocusedRowHandle = hit.RowHandle;
if (e.ClickCount == 1)
{
if (e.XButton1 == MouseButtonState.Released)
{
if (hit.Column.FieldName == "number")
{
var row = gridControl1.GetFocusedRow();
data d = (data)row;
MessageBox.Show(d.number.ToString());
x = d.number;
}
if (e.RightButton == MouseButtonState.Pressed)
{
if (hit.Column.FieldName == "image")
{
gridControl1.View.FocusedRowHandle = hit.RowHandle;
var row = gridControl1.GetFocusedRow();
data d = (data)row;
x = d.number;
popup.StaysOpen = true;
popup.IsEnabled = true;
popup.IsOpen = true;
}
}
}
}
}
}