I am having quite a bit of trouble with a radio button group. initially the radio buttons do not set the value from the ViewModel but when selected function properly. so basically the user does not know what is the initial value.
here is my xaml.
<ListBox ItemsSource="{Binding ViewModelCollection}">
<ListBox.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="rbList" IsChecked="{Binding Path=IsReady,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<Label Content="{Binding Path=NameOfRadioButton}"></Label>
</RadioButton>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
here is my ViewModel
public bool IsReady
{
get
{
return BusinessObject.IsReady; // debuggin on this line shows a true value being returned
}
set
{
BusinessObject.IsReady = value;
OnPropertyChanged("IsReady");
}
}
the Viewmodel is a simple bool value what implements INotifyPropertyChanged. i doubt i can use an enum converter as the amount of radio buttons is always dynamic.
So just to clarify, on first run no radio button is selected but after click the radiobuttons work fine. and the viewmodel and underlying database reflect the changes made.
How can i get the radio buttons to show value on startup?
cheers.