Click here to Skip to main content
15,896,382 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I've made a custom binding class which inherits from Binding:

public class MyBinding : Binding
{
  public JsBinding(): base()
  {
    InitiateBinding();
  }
  
  public JsBinding(string path) : base(path)
  {
    InitiateBinding();
  }

  private void InitiateBinding()
  {
    this.ValidatesOnDataErrors = true;
    this.ValidatesOnExceptions = true;
    this.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
    UpdateSourceExceptionFilter = UpdateSourceExceptionFilterCallback;
  }

  private object UpdateSourceExceptionFilterCallback(object bindExpression, Exception exception)
  {
    // Set focus back to bound framework element
    // Setup PreviewKeyDown and PreviewLostKeyboardFocus on bound framework element to prevent further user input until data has become valid
  }

}


The bound control is supposed to be a Framework element.

I need to access it directly to setup these events: PreviewKeyDown and PreviewLostKeyboardFocus.

But how do I access the framework element through the binding? Can this be done?

I've tried Keyboard.FocusedElement but using telerik's radnumericupdown have shown me that this may not be the same element as the binding binds to.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900