This question is locked. New answers and comments are not allowed.
Martin Roussel
Top achievements
Rank 1
Martin Roussel
asked on 21 Jul 2010, 11:41 PM
Hi,
I have a Hierarchy grid with SelectionMode="Single". Im using the SelectionChanged to detect row clicks from user. The problem I have is when we click on a already expanded (selected) parent row (SelectionChanged is not fired). Is there a way to detect those selections? SelectionMode="Multiple" seems not to do what i want.
Thanks
I have a Hierarchy grid with SelectionMode="Single". Im using the SelectionChanged to detect row clicks from user. The problem I have is when we click on a already expanded (selected) parent row (SelectionChanged is not fired). Is there a way to detect those selections? SelectionMode="Multiple" seems not to do what i want.
Thanks
5 Answers, 1 is accepted
0
Hello Martin Roussel,
All the best,
Milan
the Telerik team
Well, SelectionChanged should not be raised when you click on an already selected item. If you could give us more details about the task at hand we should be able to provide a reasonable solution. Why do you need to detect row clicks?
All the best,
Milan
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Martin Roussel
Top achievements
Rank 1
answered on 22 Jul 2010, 08:08 PM
Thanks Milan for the reply.
The reason I need the row click event is because I have an option panel with different actions (buttons) based on the selected row hierarchy. The panel is limited in space so i need to re-use some buttons that are refreshed when a row is clicked (user experience is also better... compared to showing all available actions related to the selected row and its parents). The ideal would be to unselect the childs of a clicked row, but i doubt this is possible.
The reason I need the row click event is because I have an option panel with different actions (buttons) based on the selected row hierarchy. The panel is limited in space so i need to re-use some buttons that are refreshed when a row is clicked (user experience is also better... compared to showing all available actions related to the selected row and its parents). The ideal would be to unselect the childs of a clicked row, but i doubt this is possible.
0
Hi Martin Roussel,
All the best,
Milan
the Telerik team
You could try something like this:
public MainPage() { InitializeComponent(); this.AddHandler(GridViewRow.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnRowMouseDown), true); } private void OnRowMouseDown(object sender, MouseButtonEventArgs e) { var clickedElement = e.OriginalSource as FrameworkElement; var clickedRow = clickedElement.ParentOfType<GridViewRow>(); if (clickedRow.GridViewDataControl.ParentRow == null) { // root row clicked } else { // child row clicked } }All the best,
Milan
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Martin Roussel
Top achievements
Rank 1
answered on 30 Jul 2010, 12:22 PM
Milan,
Can I have your code in VB?
I get 'MouseLeftButtonDownEvent' is not an event of 'Telerik.Windows.Controls.GridView.GridViewRow' when trying to convert it.
Sorry I didnt specified.
Thanks,
Martin
Can I have your code in VB?
I get 'MouseLeftButtonDownEvent' is not an event of 'Telerik.Windows.Controls.GridView.GridViewRow' when trying to convert it.
Sorry I didnt specified.
Thanks,
Martin
0
Hi Martin Roussel,
Regards,
Milan
the Telerik team
Could you please try the following:
Imports Telerik.Windows.Controls Partial Public Class MainPage Inherits UserControl Public Sub New() InitializeComponent() Me.AddHandler(FrameworkElement.MouseLeftButtonDownEvent, New MouseButtonEventHandler(AddressOf OnRowMouseDown), True) End Sub Private Sub OnRowMouseDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Dim clickedElement = TryCast(e.OriginalSource, FrameworkElement) Dim clickedRow = clickedElement.ParentOfType(Of GridViewRow)() If clickedRow.GridViewDataControl.ParentRow Is Nothing Then ' root row clicked Else ' child row clicked End If End Sub End ClassRegards,
Milan
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items