Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2150
Accept filtered value in dropdown
posted

I have a form where users enter some data and then submit.

If the XamMultiColumnComboEditor is the last field they want to enter, and they have the dropdown open, and they have an item selected in the dropdown and they execute the submit command, the selected item in the dropdown does not get pushed out to the binding target.

The only thing I've been able to do is a hack like so to simulate the enter keypress on that control, if the dropdown is detected to be open:

{

// Gets the element with keyboard focus.

UIElement elementWithFocus = Keyboard.FocusedElement as UIElement;

var routedEvent = Keyboard.KeyDownEvent; // Event to send

 

elementWithFocus.RaiseEvent(

new KeyEventArgs(

Keyboard.PrimaryDevice,

PresentationSource.FromVisual(elementWithFocus),

0, Key.Enter)

{ RoutedEvent=routedEvent });

 

}

Is there a less hacky way to accept the value selected in the dropdown and get binding targets to be updated?

I've spent some time (enough of it) in the source to believe that I need to somehow execute a method

CommitTextAsSelected

on ComboEditorBase.  But there is no public accessibility to get to it, insofar as I can tell.  Maybe I'm thinking about this wrong.  Please let me know.

Thanks, David