This question is locked. New answers and comments are not allowed.
Hello,
I just ran into a big problem with the GridView control. I have used the gridview control before and I was able to implement the double-click functionality without any problems. However, now my scenario is somewhat more complex and some rows of my gridview contain child tables. Here is how the gridview is defined in my XAML:
| <telerik:RadGridView x:Name="MyGrid" AutoGenerateColumns="False" |
| MultipleSelect="True" |
| Background="White" |
| ShowGroupPanel="False" |
| CanUserReorderColumns="False" |
| IsFilteringAllowed="False" |
| IsReadOnly="True" |
| ColumnsWidthMode="Fill"> |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewDataColumn Header="Name" |
| DataMemberBinding="{Binding Name}" /> |
| <telerik:GridViewDataColumn Header="Created" |
| DataMemberBinding="{Binding Created}" |
| Width="200" /> |
| </telerik:RadGridView.Columns> |
| <telerik:RadGridView.HierarchyChildTemplate> |
| <DataTemplate> |
| <telerikGridView:GridViewDataControl AutoGenerateColumns="False" |
| MultipleSelect="True" |
| Background="White" |
| ShowGroupPanel="False" |
| CanUserReorderColumns="False" |
| IsFilteringAllowed="False" |
| IsReadOnly="True" |
| ColumnsWidthMode="Fill"> |
| <telerikGridView:GridViewDataControl.Columns> |
| <telerik:GridViewDataColumn Header="Name" |
| DataMemberBinding="{Binding Name}" /> |
| <telerik:GridViewDataColumn Header="Created" |
| DataMemberBinding="{Binding Created}" |
| Width="200" /> |
| </telerikGridView:GridViewDataControl.Columns> |
| </telerikGridView:GridViewDataControl> |
| </DataTemplate> |
| </telerik:RadGridView.HierarchyChildTemplate> |
| </telerik:RadGridView> |
Not all the rows in my gridview have child tables. Therefore I used the PreviewDataRecordCreate event to create the child tables where needed. This piece of code is in the constructor of my Silverlight control:
| MyGrid.TableDefinition.PreviewDataRecordCreate += (sender, e) => { |
| Company c = (Company)e.Data; |
| if (!c.HasChildren) return; |
| GridViewTableDefinition t = new GridViewTableDefinition() { Relation = new PropertyRelation("Children") }; |
| e.ChildTableDefinitions.Add(t); |
| e.IsExpandableRecord = true; |
| }; |
The grid looks exactly what it should look like, I can expand some of the rows while some other rows are not expandable. Nevertheless, I got stuck when trying to implement double-click. Here is another piece of code from the constructor of my control:
| Mouse.AddMouseUpHandler(MyGrid, (sender, args) => { |
| if (args.ClickCount <= 1) return; |
| /* More code here... */ |
| }); |
The event is fired when I double-click a top-level item in the gridview, but clicking an item in the inner table has no effect.
I also tried catching the MouseLeftButtonUp event of the GridViewDataControl that defines the inner table, but this event was never fired as well.
I really need to implement the double-click functionality... Any help is greatly appreciated.
Regards,
Jakub Zika