Hi,
I've checked out this post but couldn't find a solution to my problem. I'm trying to change XamComboEditor in order to show an additional button next to dropdown button which clears the selected combo value. I've managed to show the extra button by using style but couldn't find a way to clear the value when the button is clicked.
Either by using style or inheriting from XamComboEditor, how can I do this?
I've attached the sample project that includes my failed attempts. I hope someone can help on this very basic problem.
Thanks in advance
No answer?
Hello,
I apologize that your post was not answered sooner. I took a look at your sample and everything is perfect except one thing - the clear button cannot be found in the ApplyTemplate method override. You have placed the button in the dropdown toggle button of the XamComboEditor but you are overriding the OnApplyTemplate of the XamComboEditor. The reason why the clear button cannot be found is because the template of the toggle button is not created yet. What you need to do is call the ApplyTemplate method before trying to get the clear button :
var dropDownButton = this.Template.FindName(ElementDropDownButton, this) as ToggleButton;
dropDownButton.ApplyTemplate();
This way, the template will be applied and the button will be found correctly.