c# - WPF combobox custom control text search functionality -
c# - WPF combobox custom control text search functionality -
i having cutom combo box command in wpf mvvm application , trying enable serach in box. means whenever user type on cmb box display pertainig records.
i using below code unable see working.
<combobox x:class="abc.selector" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:abc.viewmodels" textsearch.textpath ="{binding name}" iseditable="true"> > <combobox.itemtemplate> <datatemplate datatype="{x:type vm:myviewmodel}"> <stackpanel orientation="horizontal"> <image source="{binding image}" margin="0 0 5 0"/> <textblock text="{binding name}"/> </stackpanel> </datatemplate> </combobox.itemtemplate> this functionality works below code :
<combobox grid.column="3" grid.row="1" horizontalalignment="stretch" name="cmb" verticalalignment="stretch" height="auto" grid.columnspan="9" itemssource="{binding details}" selecteditem="{binding selected, mode=twoway}"> <textsearch.textpath>name</textsearch.textpath> <combobox.itemtemplate> <datatemplate> <textblock datacontext="{binding}"> <textblock.text> <multibinding stringformat="{}{0} - {1}"> <binding path="name" /> <binding path="longname" /> </multibinding> </textblock.text> </textblock> </datatemplate> </combobox.itemtemplate> </combobox> any thought how enable in first code block ?
textpath not expect binding actual value; expects name of property search. should set textsearch.textpath="name".
c# wpf mvvm wpf-controls
Comments
Post a Comment