Hi,
Is there some way to cancel selection? we have a XamComboEditor with AllowMultipleSelection="True" CheckBoxVisibility="Visible", and on some specific conditions we want to cancel last selection.
Is there some in box or built in feature to cancel the selection change or we have to handle it manually?
Thanks
Hello Imran,
Thank you for your post. I have been looking into it and created a sample project for you with the functionality you want. Basically I copied the default Style for the ComboBoxItemControl and handled the Grid’s, that is the Root element of the Template, MouseDown event and remove the last selected item if a particular condition is met. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Hi Stefan,
Thanks for the suggestion, but this work around have two major issues as following:
First of all we may have to create a template with style for every combobox that needs this feature.
Secondly, if we are handling SelectionChaged event, then it is fired twice for every cancel case, although we can attach and detach the event in event handler to avoid recalling on item relmoval but it still causes the selection changes event at least one.
I can suggest you bind the IsHitTestVisible Property of the Grid that is the root element of the ComboEditorItemControl Template to a Property of your object data. It this Property is false the Selection of the Items will be disabled.
Hope this helps you.