Posted in WPF, tagged ComboBox, WPF on February 28, 2008 | 3 Comments »
if we want to change the text that is displayed when user selects an item in the combobox, we have to change the ContentTemplate of the ContentPresenter in the Combobox Template
Attached is a sample(change .doc to .zip), which allows you to specify the template to be applied in the Tag property
comboboxsample2.doc
(update: added a thumb to [...]
Read Full Post »
Posted in WPF on February 26, 2008 | 4 Comments »
When you look at the Text property in the SelectionChanged event of the ComboBox it returns the prior value
here is a way to get the right value (cb1 is the name of the ComboBox)
Add this in Window loaded event
DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ComboBox.TextProperty, typeof(ComboBox));
dpd.AddValueChanged(cb1, OnTextChanged);
and here is the handler
private void OnTextChanged(object sender, EventArgs args)
{
MessageBox.Show(cb1.Text);
} [...]
Read Full Post »