Getting SelectedValue from Wpf Combobox

Hi, i don’t know why this seemed not easy but here is how it goes

Your XAML for the WPF Combo

<ComboBox Name=”ddlApplication” DisplayMemberPath=”AppName” SelectedValuePath=”ID”  SelectedItem=”App” Margin=”92.709,56,220.46,0″ VerticalAlignment=”Top” Height=”22.96″ SelectionChanged=”ddlApplication_SelectionChanged” />

Then you can easily bind a IList<YourObject> like this

  ddlApplication.ItemsSource = list;

            if (ddlApplication.HasItems)


                ddlApplication.SelectedIndex = 0;


and getting the selected value is easy as

 YourObject obj =  (YourObject)ddlApplication.SelectedItem;

            this.Title = obj .ID.ToString();

Done!  happy xamiling 

2 thoughts on “Getting SelectedValue from Wpf Combobox”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>