I have a wpf app which shows a custom combobox. The inner Textbox of the ComboBox subscribes to the TextChanged eventhandler. Additionally, the ComboBox is attached to a textfiltering behavior. It also subscribes to the textChanged eventhandler.
Now the scenario is:
Now you guess it right: I like the behavior to be the 1st subscriber, since it does the filtering and the combobox operates on the filtering results.
Event subscription is placed here: 1) Style (as StaticResource)
<Style x:Key="MyComboBoxStyle" TargetType="ComboBox">
...
<controls:TextBox x:Name="PART_EditableTextBox"
...
TextChanged="PART_EditableTextBox_TextChanged"/>
</Style>
2) behavior attaches to runtime combobox object:
<myctrl:MyComboBox>
...
<behaviors:FilterBehavior.TextBox="{Binding ElementName=PART_EditableTextBox}">
</myctrl:MyComboBox>
No option: mix behavior / combobox code, since the behavior is used to filter other textinput controls.
Can I force a subscriber to be the 1st / last of the invocation list ?
Since i learned the invocation list is mostly dispatched in order of subscription, but there's no guarantee for it, I now use a KeyUp handler rather than OnTextChanged. Thanks to Sriram for the hint!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.