There is an issue portrayed here:
http://stackoverflow.com/questions/33175983/how-to-select-item-displayed-by-displaymemberpath-in-wpf-combobox/42412423#42412423
Code of which is as follows:
cmb_Class.ItemsSource = from c in Container.Classes select new {ClassID = c.Class_Id};
cmb_Class.DisplayMemberPath = "ClassID";
I had used DisplayMemberPath so that I can only get the assigned value.
But,
The problem is that when I select an item from the dropdown menu, instead of that item the whole string is shown as selected item in the Combobox.
The solution is to add ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" into the <ContentPresenter x:Name="ContentSite" line of the Xaml.
http://stackoverflow.com/questions/33175983/how-to-select-item-displayed-by-displaymemberpath-in-wpf-combobox/42412423#42412423
Code of which is as follows:
cmb_Class.ItemsSource = from c in Container.Classes select new {ClassID = c.Class_Id};
cmb_Class.DisplayMemberPath = "ClassID";
I had used DisplayMemberPath so that I can only get the assigned value.
But,
The problem is that when I select an item from the dropdown menu, instead of that item the whole string is shown as selected item in the Combobox.
The solution is to add ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" into the <ContentPresenter x:Name="ContentSite" line of the Xaml.