void OnDialogPageCompleted(object sender, ReturnData args) { // Set background from returned color contentGrid.Background = new SolidColorBrush(args.ReturnColor); // Set RadioButton for returned color foreach (UIElement child in radioStack.Children) if ((Color)(child as RadioButton).Tag == args.ReturnColor) (child as RadioButton).IsChecked = true; (sender as DialogPage).Completed -= OnDialogPageCompleted; }
protected override void OnNavigatedFrom(NavigationEventArgs e) { if (Completed != null) { // Create ReturnData object ReturnData returnData = new ReturnData(); // Set the ReturnColor property from the RadioButton controls foreach (UIElement child in radioStack.Children) if ((child as RadioButton).IsChecked.Value) returnData.ReturnColor = (Color)(child as RadioButton).Tag; // Fire the Completed event Completed(this, returnData); } base.OnNavigatedFrom(e); }