I have the following scenario where a class like this:
public class PetOwnerViewModel{
public PetOwnerStatus Status{get{return _petOwner.Status;}}
public ICommand SetStatusCommand {get{...}}
}
Is DataContext to a group of RadioButtons similar to this:
<Parent DataContext="{Binding Path=PetOwner}" >
<Parent.Resources>
<myenums:PetOwnerStatus x:Key="CATLOVER">
CatLover
</myenums:PetOwnerStatus>
<myenums:PetOwnerStatus x:Key="DOGLOVER">
DogLover
</myenums:PetOwnerStatus>
</Parent.Resources>
<StackPanel>
<RadioButton Name="catLoverRadioButton"
Command="{Binding SetStatusCommand}"
CommandParameter="{StaticResource DOGLOVER}"
GroupName="PetOwnerStatusRadioButtonGroup">
Cat Lover
</RadioButton>
<RadioButton Name="dogLoverRadioButton"
Command="{Binding SetStatusCommand}"
CommandParameter="{StaticResource CATLOVER}"
GroupName="SubjectStatusRadioButtonGroup" >
Dog Lover
</RadioButton>
</StackPanel>
</Parent>
How do I bind the View to the ViewModel so that if PetOwnerViewModel.Status returns PetOwnerStatus.CatLover, catLoverRadioButton.IsChecked is true.