I'm working on a WPF application using Prism - MVVM.
One of my views is AddPerson, and there I have 3 radio buttons associated with the same group: Gender.
When I click on the menu- Add Person, a view is opened in my shell's content region. If I click again, a new instance of the view is opened in a new tab. But here is a problem with the radio buttons:
Suppose, I'm located on View X1: I choose Female. Then, I go to a view located on another Tab: View X2, and there I select Male. Then I return to the tab of View X1, and I discover that none of radio buttons are selected (the Female selection dissapeared).
I wander how can I solve it? I have a hint that it can be done with "Attached Property". I need to create an object that will allow for a regular radio button to define its group in such a way that it will be unique to every instance of the view. But how exactly can it be done? Thanks for any help.
<RadioButton x:Name="maleRadioBtn" GroupName="GenderGroup" Content="Male" Margin="278,344,436,122" FontSize="16" IsChecked="{Binding GenderOptions, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Male}" IsEnabled="{Binding Path=DisplayMode, Converter={StaticResource inverseBooleanConverter}}"/>
<RadioButton x:Name="femaleRadioBtn" GroupName="GenderGroup" Content="Female" Margin="396,344,300,122" FontSize="16" IsChecked="{Binding GenderOptions, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Female}" IsEnabled="{Binding Path=DisplayMode, Converter={StaticResource inverseBooleanConverter}}"/>
<RadioButton x:Name="Unknown" GroupName="GenderGroup" Content="Unknown" Margin="541,344,145,122" FontSize="16" IsChecked="{Binding GenderOptions, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Unknown}" IsEnabled="{Binding Path=DisplayMode, Converter={StaticResource inverseBooleanConverter}}"/>