Table of Contents


It is very simple issue ,but we can't to make checked event fire on same radiobutton which is already selected. Actually this question is raised at Msdn WindowsPhone Development Forums .
         Page having two radio buttons for :1)Phone 2)Email 

          So if the user wants to register via phone number then he needs to turn on his cellular data connection...when he/she comes back to the app the radionbutton will be already selected, but I want the user to select the same radiobutton that the mobile data connection takes effect....


There is two ways for solving this issue:

1)kept your radio button IsChecked=false; at OnNaviagatedTo event ,so that when user return back to page then automatically your radio button will be unchecked so that he can again able to check the radiobutton

protected override void OnNavigatedTo(NavigationEventArgs e)
            PhoneRadioBtn.IsChecked = false;
 private void PhoneRadio_check(object sender, RoutedEventArgs e)
             Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-cellular:"));

2)Using Tap event of RadioButton:
 We have Tap event for radio button,However it will be fire after checked event so that we can check on tap event whether RadioButton is already selected or not,If it is already selected makes once PhoneRadio.IsChecked=false; and set again PhoneRadio.IsChecked=true;

Note: PhoneRadio.IsChecked=true;  when you set this PhoneRadio Checked Event will be fire automatically.


 <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            <RadioButton Tap="PhoneRadio_Tap" Grid.Row="0" Checked="PhonetRadio_check" 
Content="Phone"  Name="PhonetRadio" GroupName="MyRadioButtons"/>
            <RadioButton Grid.Row="1" Content="Email" Name="EmailRadio" 
GroupName="MyRadioButtons" Margin="0,0,0,67"/>

Note: Set GroupName property for both the radiobuttons. So when you select one radiobutton, other radiobutton will get unselected.


PhonetRadio_check  Event:

private void PhonetRadio_check(object sender, RoutedEventArgs e)
             Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-cellular:"));


PhoneRadio_Tap Event

 private void PhoneRadio_Tap(object sender, System.Windows.Input.GestureEventArgs e)
             if (PhonetRadio.IsChecked == true)
                 PhonetRadio.IsChecked = false;
                 PhonetRadio.IsChecked = true;


Msdn Forum: Link

And please find my more MSDN Code samples