Hello,
I have a RadGridView for which I'd like to take advantage of the extended selection mode (shift-click, ctl-click, etc...), but also need the act of clicking on a row to add it to the list of selected rows without clearing out the other entries. I would also like the act of clicking on a row that is already selected to remove it from the list of selected rows - much the same way Multiple selection mode behaves.
Is there a way to implement this behavior?
Thanks
I have a RadGridView for which I'd like to take advantage of the extended selection mode (shift-click, ctl-click, etc...), but also need the act of clicking on a row to add it to the list of selected rows without clearing out the other entries. I would also like the act of clicking on a row that is already selected to remove it from the list of selected rows - much the same way Multiple selection mode behaves.
Is there a way to implement this behavior?
Thanks
4 Answers, 1 is accepted
0
Hello,
Didie
the Telerik team
Unfortunately the different SelectionModes cannot be mixed. You could use the one you find more convenient for your solution.
Kind regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 06 Jun 2012, 11:55 AM
Thanks for your response.
I haven't found an event I can hook into yet that would really meet this need (i.e. the additive row selection / deselection) - the closest I've found is the CurrentCellChanged event; however, that seems to fire more often than I would like / can be fired due to a programmatic selection change / doesn't fire at all if you click on the current cell again.
Are there any plans to include a RowClick event in the future, or is there one exposed now that I have simply not yet found?
Thanks
I haven't found an event I can hook into yet that would really meet this need (i.e. the additive row selection / deselection) - the closest I've found is the CurrentCellChanged event; however, that seems to fire more often than I would like / can be fired due to a programmatic selection change / doesn't fire at all if you click on the current cell again.
Are there any plans to include a RowClick event in the future, or is there one exposed now that I have simply not yet found?
Thanks
0
Accepted
Hi,
I hope this is helpful.
Greetings,
Didie
the Telerik team
The events that you could use in order to control selection are:
SelectedCellsChanging and SelectionChanging.
In order to control the click on a row, I would suggest you the following way:
public
MainWindow()
{...
this
.RadGridView.CanUserSelect =
false
;
this
.AddHandler(FrameworkElement.MouseDownEvent,
new
System.Windows.Input.MouseButtonEventHandler(OnMouseDown),
true
);
}
private
void
OnMouseDown(
object
sender, MouseButtonEventArgs e)
{
var s = e.OriginalSource
as
FrameworkElement;
var parentRow = s.ParentOfType<GridViewRow>();
if
(parentRow !=
null
)
{
if
(Keyboard.Modifiers == ModifierKeys.Control)
{
parentRow.IsSelected =
false
;
}
else
{
parentRow.IsSelected =
true
;
}
}
}
I hope this is helpful.
Greetings,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 06 Jun 2012, 07:41 PM
This works quite well actually, thank you. With some modifications I think I'll be able to use it as a stepping stone to achieve the behavior I'm looking for.
Thanks for your responses
Thanks for your responses