Hello I want to double click the row from xamDataFrid and want to do something on it.
I mean on that double click event.
Can you help me please How it can be done?
Thanks and regards,
Pratibha.
Hello Pratibha,
In order to handle a double-click event of a Record, you can handle the MouseDoubleClick event of the DataRecordPresenter by hooking for it through an EventSetter.
XAML:
<Style TargetType="igDP:DataRecordPresenter"> <EventSetter Event="MouseDoubleClick" Handler="DataRecordPresenter_MouseDoubleClick" /></Style>
Code-behind:
private void DataRecordPresenter_MouseDoubleClick(object sender, MouseButtonEventArgs e){ MessageBox.Show("DataRecordPresenter was double-clicked.");}
I have attached a sample that uses the approach from above.
If you have any questions, please let me know.
Hello ,
Thanks for the reply.
The solution you provided I am usiing the same.
But I want to load a RowTempate on that row double click event.
How it can be achieved?
Regards,
Pratibha
Presuming that you would like to retemplate the record inside the handler of it's MouseDoubleClick event, I can suggest you to set the Template property of the DataRecordPresenter (visual representation of the Record/Row) inside of it.
private void DataRecordPresenter_MouseDoubleClick(object sender, MouseButtonEventArgs e){ (sender as DataRecordPresenter).Template = ...}
Hello Tacho,
Actually previously I was using a expand button to expan d the row but now I want to expand that row on double click event.
And when I double click on any row the row details should get diplayed.
And for Row details I am having a RowDetailsTemplate,previoulsy It is used in style with scrollviwer into expander like below
<ScrollViewer ContentTemplate="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igDP:XamDataGrid}}, Path=RowDetailsTemplate}" Content="{Binding DataItem}" VerticalScrollBarVisibility="Auto"/>
How can I expand it on double click now?
Actually the type my template is DataTemplate