Hi,
We are using rad combo box for binding the values. We are in the position to bind the values but while saving the values we are not able to get the RadCombo box selected value in the data context by using two way binding. please find the code below
Thanks
Sreeraman
We are using rad combo box for binding the values. We are in the position to bind the values but while saving the values we are not able to get the RadCombo box selected value in the data context by using two way binding. please find the code below
<telerikInput:RadComboBox Margin="0 2 0 0" x:Name="cbState" DisplayMemberPath="StateName" |
ItemsSource="{Binding States}" SelectedItem="{Binding StateHome,Mode=TwoWay}" |
Height="10" IsEditable="False" Background="White" FontSize="9"> |
</telerikInput:RadComboBox> |
xaml.cs page code: |
#region Declaration |
private readonly DummyData data = new DummyData(); |
#endregion |
public NurseQueue() |
{ |
InitializeComponent(); |
cbState.DisplayMemberPath = "HomeState"; |
} |
public class DummyData |
{ |
private readonly List<State> states = new List<State> |
{ |
new State {StateName = "Texas", IsDefault = false}, |
new State {StateName = "New York", IsDefault = false}, |
new State {StateName = "Alaska", IsDefault = true} |
}; |
public List<State> States |
{ |
get |
{ |
return states; |
} |
} |
public State HomeState |
{ |
get |
{ |
return States.First(StateName => StateName.IsDefault); |
} |
} |
} |
public class State |
{ |
public string StateName { get; set; } |
public bool IsDefault { get; set; } |
} |
Thanks
Sreeraman