xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.89k stars 877 forks source link

Issue with Watermark ComboBox ContentPresenter XAML #1127

Open xceedsoftware opened 7 years ago

xceedsoftware commented 7 years ago

Yokomoko[CodePlex]
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 = quotClassIDquot; 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=quot{TemplateBinding ItemTemplateSelector}quot into the ltContentPresenter x:Name=quotContentSitequot line of the Xaml.

xceedsoftware commented 7 years ago

BoucherS[CodePlex]
Hi,

Can you please elaborate on this ? The XAML of the WatermarkComboBox doesn't contains a ContentPresenter with x:Name=ContentSite. Which version of the Toolkit are you using ? In 3.3, this bug is not present. Also tried with v3.0 and bug is not present. Here's the sample used : xctk:WatermarkComboBox x:Name=cmb_Class / public partial class MainWindow : Window { public MainWindow() { InitializeComponent();

  cmb_Class.ItemsSource = new ListMyData() { new MyData() { ClassID = 1 }, new MyData() { ClassID = 2 }, new MyData() { ClassID = 3 } };
  cmb_Class.DisplayMemberPath = ClassID;
}

}

public class MyData { public int ClassID { get; set; } } ―――― Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF