C# WPF How to send ID from Combobox?

C# WPF How to send ID from Combobox?

As now I got a combobox with name values. What I want is to send with ID corresponding to the chosen name value as a parameter to the viewmodel.

How can I do this? At this moment, I only seem to be able to retrieve the name of the item, but I also want to get the ID corresponding to the item.

This is due I got the ID and Name in a table in DB.

 <TextBlock Text="Market Name" VerticalAlignment="Center" /> <telerik:RadComboBox Text="{Binding News.Name, Mode=TwoWay}" Margin="0 4 0 4" FontSize="13" IsReadOnly="True" ItemsSource="{Binding GetNews}" DisplayMemberPath="Title" CommandParameter="{Binding NewsID}" /> 

submitted by /u/Lekowski
[link] [comments]

Leave a Reply