How to bind a ComboBox to generic dictionary with xaml code

Posted by MMD MNC on Stack Overflow See other posts from Stack Overflow or by MMD MNC
Published on 2012-10-20T16:57:30Z Indexed on 2012/10/20 17:00 UTC
Read the original article Hit count: 210

Filed under:
|
|
|

I'm using the following code :

private Dictionary<string, string> GetNumber { get; set; }
public ReportsLetterTra()
{
    GetMonth = new Dictionary<string, string>
                            {
                                {"1", "First"},
                                {"2", "Second"}
                            };

    InitializeComponent();
}

xaml code :

 <ComboBox DisplayMemberPath="value" SelectedValuePath="key" ItemsSource="{Binding ElementName=reportslettra,Path=GetNumber}"  SelectedIndex="0"  Name="cmbFromNumber"    />

Why is not bind GetNumber to cmbFromNumber?!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml