BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi Jochen,
We have analyzed your query and you can achieve your requirement by using CellClick event, in that event arguments you can get the ClickCount, based on ClickCount property you can do your action as shown in the below code snippet,
public MainWindow() { InitializeComponent(); dataGrid.CellClick += dataGrid_CellClick; }
void dataGrid_CellClick(object sender, GridCellClickEventArgs e) { if (e.ClickCount==2) { //code for cell Double click action } } |
Please let us know if you have any queries.
Regards,
Akila
Do I miss something here?
Best
Hi
Jochen,
Sorry
for the inconvenience . We have provide the previous sample in WPF platform and
there is no support for ClickCount property in CellGrid event .You can achieve the double
click event by using MouseLeftButtonUp event as shown in the below code
snippet,
public MainPage() {
InitializeComponent(); columnStylegrid.MouseLeftButtonUp
+= columnStylegrid_MouseLeftButtonUp; } DateTime? previousclick; void columnStylegrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (previousclick != null && DateTime.Now.Subtract((DateTime)previousclick).TotalMilliseconds
< 100) {
previousclick = null;
MessageBox.Show("Double click!"); } else
previousclick = DateTime.Now; } |
Please
let us know if you have any queries.
Regards,
Akila
Hi Jochen,
In the already provided solution, if condition will be true only when you double click the Cell. In the remaining cases, else part will be executed.
public MainPage() { InitializeComponent(); columnStylegrid.MouseLeftButtonUp += columnStylegrid_MouseLeftButtonUp; } DateTime? previousclick; void columnStylegrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (previousclick != null && DateTime.Now.Subtract((DateTime)previousclick).TotalMilliseconds < 100) { previousclick = null; MessageBox.Show("Double click!");
} else previousclick = DateTime.Now; }
|
We have achieved the same using helper to fire event only in case of double click. Please find the sample from the below specified location.
Please let us know if you have any queries,
Regards,