3 Answers, 1 is accepted
0
Hello,
You can try subscribing for the KeyDown event of the FrameworkElement directly and handle the key combination:
Then, you can modify the selection:
Regards,
Dimitrina
Telerik
You can try subscribing for the KeyDown event of the FrameworkElement directly and handle the key combination:
this
.AddHandler(FrameworkElement.KeyDownEvent,
new
KeyEventHandler(OnKeyDown),
true
);
Then, you can modify the selection:
private
void
OnKeyDown(
object
sender, System.Windows.Input.KeyEventArgs e)
{
if
(e.Key == Key.A && Keyboard.Modifiers == ModifierKeys.Control)
{
clubsGrid.UnselectAll();
e.Handled =
true
;
}
}
Regards,
Dimitrina
Telerik
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 Feedback Portal
and vote to affect the priority of the items
0
Leon
Top achievements
Rank 1
answered on 16 Jun 2015, 12:15 PM
Thank you.
I don't want to unselect anyhing.
All I want is to prevent grid from handling select all.
0
Hi,
The SelectAll command is an ApplicationCommand and it cannot be canceled from RadGridView level.
A workaround to prevent the selection would be to subscribe for the SelectionChanging event and Cancel it base on a Boolean flag.
For example:
Regards,
Dimitrina
Telerik
The SelectAll command is an ApplicationCommand and it cannot be canceled from RadGridView level.
A workaround to prevent the selection would be to subscribe for the SelectionChanging event and Cancel it base on a Boolean flag.
For example:
private
bool
IsSelectAllCommandExecuted;
public
MainWindow()
{
InitializeComponent();
this
.AddHandler(RadGridView.PreviewKeyDownEvent,
new
KeyEventHandler(OnPreviewKeyDown),
true
);
this
.clubsGrid.SelectionChanging +=
this
.OnSelectionChanging;
}
void
OnSelectionChanging(
object
sender, SelectionChangingEventArgs e)
{
e.Cancel =
this
.IsSelectAllCommandExecuted;
this
.IsSelectAllCommandExecuted =
false
;
}
private
void
OnPreviewKeyDown(
object
sender, KeyEventArgs e)
{
this
.IsSelectAllCommandExecuted = e.Key == Key.A && KeyboardModifiers.IsControlDown;
}
Regards,
Dimitrina
Telerik
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 Feedback Portal
and vote to affect the priority of the items