I want to pass radio button content between pages. XAML Code:
<RadioButton Name="errorCorrectionHLevelRadioButton"
Content="H (~30% correction)"
GroupName="errorCorrectionLevel"
IsChecked="True" BorderBrush="Black" Foreground="Black" Background="Black"
/>
<RadioButton Name="errorCorrectionLLevelRadioButton"
Content="Q (~25% correction)"
GroupName="errorCorrectionLevel" BorderBrush="Black" Foreground="Black" Background="Black"
/>
<RadioButton Name="errorCorrectionMLevelRadioButton"
Content="M (~15% correction)"
GroupName="errorCorrectionLevel" BorderBrush="Black" Foreground="Black" Background="Black"
/>
<RadioButton Name="errorCorrectionQLevelRadioButton"
Content="L (~7% correction)"
GroupName="errorCorrectionLevel" BorderBrush="Black" Foreground="Black" Background="Black"
/>
First page code:
string myECL;
if (errorCorrectionHLevelRadioButton.IsChecked == true)
myECL = ErrorCorrectionLevel.H.ToString();
else if (errorCorrectionQLevelRadioButton.IsChecked == true)
myECL = ErrorCorrectionLevel.Q.ToString();
else if (errorCorrectionMLevelRadioButton.IsChecked == true)
myECL = ErrorCorrectionLevel.M.ToString();
else
myECL = ErrorCorrectionLevel.L.ToString();
NavigationService.Navigate(new Uri("/QRGeneratePage.xaml?text=" + textToEncodeTextBox.Text +"&errorCorrection="+myECL+"&logo="+logoQrCodeImage.Source, UriKind.Relative));
And on the second page I want to use date form radio buton. For example: I have a constructor where:
string errorCorrectionLevelChoose = String.Empty;
if (NavigationContext.QueryString.TryGetValue("errorCorrection", out errorCorrectionLevelChoose))
{
ErrorCorrectionLevel ecl = (ZXing.QrCode.Internal.ErrorCorrectionLevel)errorCorrectionLevelChoose;
}
var writer = new BarcodeWriter
{
Format = BarcodeFormat.QR_CODE,
Renderer = new ZXing.Rendering.WriteableBitmapRenderer()
{
Foreground = colorQRCode
},
Options = new ZXing.QrCode.QrCodeEncodingOptions
{
Height = 300,
Width = 300,
Margin = 1,
ErrorCorrection = ErrorCorrectionLevel.H
}
};
In this line ErrorCorrection = ErrorCorrectionLevel.H I want to use my data from radio button. So if user choose
<RadioButton Name="errorCorrectionLLevelRadioButton"
Content="Q (~25% correction)"
GroupName="errorCorrectionLevel" BorderBrush="Black" Foreground="Black" Background="Black"
/>
On the second page it will be:
ErrorCorrection = ErrorCorrectionLevel.Q
Do you know how I can do this ?