Hello all,
I am able to bind a "MyDictionary.Value" to a ComboBox and see the Values in it:
Dictionary<string, Friends> friend_list = new Dictionary<string, Friends>();
Friend_chat_list.ItemsSource = friend_list.Values;
And here is the XAML code:
<ComboBox x:Name="Friend_chat_list" Width="90" ItemsSource="{Binding}" SelectionChanged="Friend_chat_list_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" TextTrimming="WordEllipsis"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Here is the class I used to create my dictionnay:
public class Friends
{
public string Friend_guid { get; set; }
public string Name { get; set; }
public string Message { get; set; }
public string FriendAvatar { get; set; }
public string Status { get; set; }
public string Status_Image { get; set; }
public List<Chat> chat_list { get; set; }
}
What I would like to do is bind the string "Friend_guid" as a ValueMember and not a DisplayMEmber, that I could retrieve on event "SelectionChanged". The user would only see the "Friend_name" in the combobox but it would return me "Friend_guid" instead of "Friend_name".
Help would be greatly appreciated.
Ephismen.