Reputation: 946
I have a silverlight app that populates a combobox from a sharepoint list.
here's the assignment of the combobox and I was able to bind to the combobox using an INotifyProperty. I am stuck on how to go about getting the value of the Display Member of the combobox.
<ComboBox Name="cboAwardType" SelectedValue="{Binding SelectedAwardType, Mode=TwoWay}"
ItemsSource="{Binding}" DataContext="{Binding}" />
code behind
void _hrwebservice_GetAwardTypesCompleted(object sender, GetAwardTypesCompletedEventArgs e)
{
List<AwardType> awardTypes = (List<AwardType>)e.Result.ToList();
cboAwardType.ItemsSource = awardTypes;
cboAwardType.DisplayMemberPath = "AType";
cboAwardType.SelectedValuePath = "ID";
}
I can see the value in the SelectedItem. How do i access that AType value?
Upvotes: 0
Views: 971
Reputation: 2279
Maybe...
var selectedType = ((AwardType) cboAwardType.SelectedItem).AType;
Upvotes: 1