This question is locked. New answers and comments are not allowed.
We are using the RadDataFilter as a search criteria control and a radgridview to display the results. At present we have a button, which is associated with a command, that performs the search.
Would it be possible to handle the KeyDown event for the filter editors in the DataFilter so that we can fire the command when the used presses enter (ideally, any of the filter editors, but the StringFilterEditor especially)?
Elsewhere we have used a behavior to associate a command with the KeyDown on a control (and then we fire the command if the key is Enter) , e.g.:
Would it be possible to handle the KeyDown event for the filter editors in the DataFilter so that we can fire the command when the used presses enter (ideally, any of the filter editors, but the StringFilterEditor especially)?
Elsewhere we have used a behavior to associate a command with the KeyDown on a control (and then we fire the command if the key is Enter) , e.g.:
public class DefaultCommit : Behavior<
TextBox
> {
protected override void OnAttach() {
AssociatedObject.KeyDown += OnTextBoxKeyDown;
}
protected override void OnDetach() {
AssociatedObject.KeyDown -= OnTextBoxKeyDown;
}
void AssociatedObject_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter && Command != null)
{
var be = AssociatedObject.GetBindingExpression(TextBox.TextProperty);
if (be != null)
{
be.UpdateSource();
}
Command.Execute(AssociatedObject.DataContext);
}
}
}
I have tried using a similar behavior inside the template for the StringFilterEditor, but the binding (using ElementName) doesn't work.
Is there a way that this can be achieved within the DataFilter control?
Thanks