- Home
- Forum
- Silverlight
- DoubleClick Event on Row possible
DoubleClick Event on Row possible
is it possible to create a DoubleClick Event on the Row of a GridDataControl?
Best
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
- On the GridDataControl class I have no CellClick Event directly.
If I goto the model.grid of GridDataControl there is a event called "CellClick"
dataGrid.Model.Grid.CellClick += Grid_CellClick;
As I use this it will lead me to the following problem.. - I only get these Properties on GridCellEventArgs:
So there is no Property "ClickCount".
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
with this workaround it would be difficult to choose between single and double click as a double click would always fire the single click too.
Best
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,
Attachment: DoubleClickDemo_a88aa7ad.zip
- 5 Replies
- 2 Participants
-
JR Jochen Renner
- Jun 2, 2014 12:20 PM UTC
- Jun 6, 2014 01:34 PM UTC