Hi,
I am having a hard time figuring out how to make the Text property of the RadComboBox bind to a string property in my View Model. I have a combo box that is Editable so that user can search for anything that starts with the values typed on the text box. I want to get that value in the view model, use it as part of a LINQ query (sarts with), and fill a collection source to display on a view.
The problem:
------------------
The string property on my view model "SearchText" is returning null (never gets the value entered by user). Sample code is below:
Please advice if this is possible or if I am missing something.
Thanks,
Gabe.
I am having a hard time figuring out how to make the Text property of the RadComboBox bind to a string property in my View Model. I have a combo box that is Editable so that user can search for anything that starts with the values typed on the text box. I want to get that value in the view model, use it as part of a LINQ query (sarts with), and fill a collection source to display on a view.
The problem:
------------------
The string property on my view model "SearchText" is returning null (never gets the value entered by user). Sample code is below:
private List<SupplierMaster> foundSuppliers; public List<SupplierMaster> FoundSuppliers { get { return foundSuppliers; } set { if (foundSuppliers == value) return; foundSuppliers = value; OnPropertyChanged("FoundSuppliers"); } } private string searchText; public string SearchText { get { return searchText; } set { if (searchText == value) return; searchText = value; OnPropertyChanged("SearchText"); } } private void Search() { FoundSuppliers = (from sm in SupplierMaster where sm.SupplierName.ToUpperInvariant().StartsWith(SearchText.ToUpperInvariant()) select sm).ToList(); //Here the SearchText property is always null **ISSUE** FoundSuppliers = FoundSuppliers.OrderBy(n => n.SupplierName).ToList(); } } XAML: <telerik:RadComboBox Height="23" Name="txtSearchBox" TabIndex="1" HorizontalAlignment="Left" Width="246" IsEnabled="True" VerticalAlignment="Top" IsEditable="True" IsTextSearchEnabled="True" IsTextSearchCaseSensitive="True" Text="{Binding SearchText}" TextSearchMode="StartsWithCaseSensitive" Margin="0,3" ItemsSource="{Binding SupplierMaster}" DisplayMemberPath="SupplierName" SelectedValuePath="SupplierName" SelectedItem="{Binding SelectedSupplier}" EmptyText="Name starts with..." > <telerik:RadComboBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel /> </ItemsPanelTemplate> </telerik:RadComboBox.ItemsPanel> </telerik:RadComboBox>Please advice if this is possible or if I am missing something.
Thanks,
Gabe.