c# - Can I check if the selectedItem of comboBox is there in the itemsource or not using triggers and/or converters? -
i have various comboboxes in various view have different itemsource want generic way check if user selected value there in corresponding itemsource. comboboxes editable want inform user when enetering junk value changing foreground red.
<window x:class="customcombobox.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <stackpanel verticalalignment="center"> <combobox name="cmbbox" width="100" height="30" iseditable="true" staysopenonedit="true" > <combobox.style> <style targettype="combobox"> <style.triggers> <trigger property="selectedindex" value="-1"> <setter property="foreground" value="red"/> </trigger> </style.triggers> </style> </combobox.style> </combobox> </stackpanel> </grid> </window>
hope helps
Comments
Post a Comment