//------------------------------------------------------------------------------- #endregion (Util) //------------------------------------------------------------------------------- #region Constructor //------------------------------------------------------------------------------- // public ListPage() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; this.navigationHelper.SaveState += navigationHelper_SaveState; CANVASES = new Canvas[] { canvasMap1_E123, canvasMap1_E456, canvasMap1_W, canvasMap2_E123, canvasMap2_E456, canvasMap2_W, canvasMap3_E123, canvasMap3_E456, canvasMap3_W }; SCROLLVIEWERS = new ScrollViewer[] { scImgMap1_E123, scImgMap1_E456, scImgMap1_W, scImgMap2_E123, scImgMap2_E456, scImgMap2_W, scImgMap3_E123, scImgMap3_E456, scImgMap3_W }; SELECT_BORDERS = new Border[] { borderMap1_E123, borderMap1_E456, borderMap1_W, borderMap2_E123, borderMap2_E456, borderMap2_W, borderMap3_E123, borderMap3_E456, borderMap3_W }; RADIOBUTTONS = new RadioButton[] { rbSearch_Checklist, rbSearch_SearchString, rbSearch_Genre }; }
private void addChoices(SurveyQuestion p_targetQuestion) { switch (p_targetQuestion.Type) { case "radio": foreach (var choice in p_targetQuestion.Choices) { RadioButton rb = new RadioButton(); rb.Content = choice.Text; rb.Margin = new Thickness(20); rb.Foreground = new SolidColorBrush(Color.FromArgb(0, 3, 22, 52)); this.ChoiceArea.Children.Add(rb); } break; case "check": foreach (var choice in p_targetQuestion.Choices) { CheckBox cb = new CheckBox(); cb.Content = choice.Text; cb.Margin = new Thickness(20); cb.Foreground = new SolidColorBrush(Color.FromArgb(255, 3, 22, 52)); cb.Width = 350; this.ChoiceArea.Children.Add(cb); } break; default: break; } }
public SymbolUserControl(YouMapsSymbol youmapsSymbol) { CheckBoxEverything = new CheckBox(); SymbolNameText = new TextBlock(); EditRadioButton = new RadioButton(); this.InitializeComponent(); this.YouMapsSymbol = youmapsSymbol; SymbolNameText.Text = youmapsSymbol.Name; SymbolNameText.FontSize = 30; ControlStackpanel.Children.Add(CheckBoxEverything); ControlStackpanel.Children.Add(SymbolNameText); ControlStackpanel.Children.Add(EditRadioButton); }
public override FrameworkElement buildFieldView() { StackPanel radioGroup = new StackPanel(); radioGroup.HorizontalAlignment = HorizontalAlignment.Stretch; radioGroup.VerticalAlignment = VerticalAlignment.Top; radioGroup.Orientation = Orientation.Vertical; int numberOfOptions; if (getField().getFieldInfo().getOptions() != null && getField().getFieldInfo().getOptions().Any()) { numberOfOptions = getField().getFieldInfo().getOptions().Count; RadioButton[] options = new RadioButton[numberOfOptions]; String groupName = Guid.NewGuid().ToString(); for (int i = 0; i < numberOfOptions; i++) { options[i] = new RadioButton(); options[i].FontFamily = getSkin().getFieldFont(); options[i].FontSize = getSkin().getFieldFontSize(); options[i].Content = getField().getFieldInfo().getOptions()[i].getValue(); options[i].GroupName = groupName; if (getField().getFieldInfo().isReadOnly()) { options[i].IsEnabled = false; } radioGroup.Children.Add(options[i]); } } else { //YES NO OPTIONS numberOfOptions = 2; RadioButton[] options = new RadioButton[numberOfOptions]; options[0] = new RadioButton(); options[0].FontFamily = getSkin().getFieldFont(); options[0].FontSize = getSkin().getFieldFontSize(); options[0].Content = Localization.translate("option.yes"); options[1] = new RadioButton(); options[1].FontFamily = getSkin().getFieldFont(); options[1].FontSize = getSkin().getFieldFontSize(); options[1].Content = Localization.translate("option.no"); if (getField().getFieldInfo().isReadOnly()) { options[0].IsEnabled = false; options[1].IsEnabled = false; } radioGroup.Children.Add(options[0]); radioGroup.Children.Add(options[1]); } return radioGroup; }
protected override void OnApplyTemplate() { if (_checkDragGrouping == null) { _checkDragGrouping = GetTemplateChild("checkDragGrouping") as RadioButton; _checkDragGrouping.Checked += _checkDragGrouping_Checked; } if (_checkDragReordering == null) { _checkDragReordering = GetTemplateChild("checkDragReordering") as RadioButton; _checkDragReordering.Checked += _checkDragReordering_Checked; } base.OnApplyTemplate(); }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { //TODO: Create an appropriate data model for your problem domain to replace the sample data while (Frame.BackStackDepth > 1) { Frame.BackStack.RemoveAt(Frame.BackStackDepth - 1); } Test newTest = await QuestionsDataSource.GetTestAsync(testname); for (int i = 0; i < newTest.questions.Count; i++) { TestQuestion question = newTest.questions[i]; StackPanel outerpanel = new StackPanel(); outerpanel.Orientation = Orientation.Vertical; TextBlock quesview = new TextBlock(); quesview.Text = question.question; outerpanel.Children.Add(quesview); if(question.type=="mcq") { RadioButton[] radioButtons = new RadioButton[question.choices.Count]; int j = 0; foreach(var kvp in question.choices) { radioButtons[j] = new RadioButton(); radioButtons[j].Content = kvp.Value; outerpanel.Children.Add(radioButtons[j++]); } } else if(question.type == "sub") { TextBox answer = new TextBox(); answer.HorizontalAlignment = HorizontalAlignment.Stretch; answer.VerticalAlignment = VerticalAlignment.Stretch; answer.TextWrapping = TextWrapping.Wrap; outerpanel.Children.Add(answer); } Hub.Children.Add(outerpanel); } }
private UIElement CreateRadioButton(KeyValuePair<string, Func<Map>> sample) { var radioButton = new RadioButton { FontSize = 16, Content = sample.Key, Margin = new Thickness(4) }; radioButton.Click += (s, a) => { MapControl.Map.Layers.Clear(); MapControl.Map = sample.Value(); MapControl.Refresh(); }; return radioButton; }
public void SetNavigationInfo(string title = null, string menuItemNameToSelect = null) { if (!string.IsNullOrEmpty(title)) tbTitle.Text = Utils.GetLabelValue(title).ToUpper(); if (!string.IsNullOrEmpty(menuItemNameToSelect)) { var ctrl = FindName(menuItemNameToSelect); if (ctrl != null) { var rb = ctrl as RadioButton; if (rb != null) { rb.IsChecked = true; checkedMenuItem = rb; } } } }
void InitializeFeaturePage(Grid grid, DependencyProperty chooserProperty, TypographyFeaturePage page) { if (page == null) { grid.Children.Clear(); grid.RowDefinitions.Clear(); } else { // Get the property value and metadata. object value = GetValue(chooserProperty); var metadata = (TypographicPropertyMetadata)chooserProperty.GetMetadata(typeof(FontChooser)); // Look up the sample text. string sampleText = (metadata.SampleTextTag != null) ? LookupString(metadata.SampleTextTag) : _defaultSampleText; if (page == _currentFeaturePage) { // Update the state of the controls. for (int i = 0; i < page.Items.Length; ++i) { // Check the radio button if it matches the current property value. if (page.Items[i].Value.Equals(value)) { var radioButton = (RadioButton)grid.Children[i * 2]; radioButton.IsChecked = true; } // Apply properties to the sample text block. var sample = (TextBlock)grid.Children[i * 2 + 1]; sample.Text = sampleText; ApplyPropertiesToObjectExcept(sample, chooserProperty); sample.SetValue(metadata.TargetProperty, page.Items[i].Value); } } else { grid.Children.Clear(); grid.RowDefinitions.Clear(); // Add row definitions. for (int i = 0; i < page.Items.Length; ++i) { var row = new RowDefinition(); row.Height = GridLength.Auto; grid.RowDefinitions.Add(row); } // Add the controls. for (int i = 0; i < page.Items.Length; ++i) { string tag = page.Items[i].Tag; var radioContent = new TextBlock(new Run(LookupString(tag))); radioContent.TextWrapping = TextWrapping.Wrap; // Add the radio button. var radioButton = new RadioButton(); radioButton.Name = tag; radioButton.Content = radioContent; radioButton.Margin = new Thickness(5.0, 0.0, 0.0, 0.0); radioButton.VerticalAlignment = VerticalAlignment.Center; Grid.SetRow(radioButton, i); grid.Children.Add(radioButton); // Check the radio button if it matches the current property value. if (page.Items[i].Value.Equals(value)) { radioButton.IsChecked = true; } // Hook up the event. radioButton.Checked += featureRadioButton_Checked; // Add the block with sample text. var sample = new TextBlock(new Run(sampleText)); sample.Margin = new Thickness(5.0, 5.0, 5.0, 0.0); sample.TextWrapping = TextWrapping.WrapWithOverflow; ApplyPropertiesToObjectExcept(sample, chooserProperty); sample.SetValue(metadata.TargetProperty, page.Items[i].Value); Grid.SetRow(sample, i); Grid.SetColumn(sample, 1); grid.Children.Add(sample); } // Add borders between rows. for (int i = 0; i < page.Items.Length; ++i) { var border = new Border(); border.BorderThickness = new Thickness(0.0, 0.0, 0.0, 1.0); border.BorderBrush = SystemColors.ControlLightBrush; Grid.SetRow(border, i); Grid.SetColumnSpan(border, 2); grid.Children.Add(border); } } } _currentFeature = chooserProperty; _currentFeaturePage = page; }
public void CallCompleted(ApiResponse result) { RadioGroup radioGrupo = new RadioGroup(); List<GetSurveyQuestionsResponse> response = result.GetTypedResponse<List<GetSurveyQuestionsResponse>>(); foreach (GetSurveyQuestionsResponse item in response) { radioGrupo = new RadioGroup(); radioGrupo.Text(item.des); radioGrupo.IdPregunta = item.qid; foreach (var itemAnswers in item.answers) { RadioButton radio = new RadioButton(); radio.Style = App.Current.Resources["RadioBridgstone"] as Style; ; radio.Content = itemAnswers.des; radio.Name = itemAnswers.aid.ToString(); radio.Margin = new Thickness(10, 0, 0, 0); radio.Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 0x47, 0x44, 0x44)); radio.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x8C, 0x8A, 0x8B)); radioGrupo.addChildren(radio); } stackBody.Children.Add(radioGrupo); } }
private void RadioButton_Checked(object sender, RoutedEventArgs e) { option = sender as RadioButton; }
private void OnTextBlockRightTapped(object sender, RightTappedRoutedEventArgs e) { StackPanel stackPanel = new StackPanel(); // Create two Button controls and add to StackPanel Button btn1 = new Button { Content = "Larger font", Tag = 1.2, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(12) }; btn1.Click += OnButtonClick; stackPanel.Children.Add(btn1); Button btn2 = new Button { Content = "Smaller font", Tag = 1 / 1.2, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(12) }; btn2.Click += OnButtonClick; stackPanel.Children.Add(btn2); // Create three RadioButton controls and add to StackPanel string[] names = { "Red", "Green", "Blue" }; Color[] colors = { Colors.Red, Colors.Green, Colors.Blue }; for (int i = 0; i < names.Length; i++) { RadioButton radioButton = new RadioButton { Content = names[i], Foreground = new SolidColorBrush(colors[i]), IsChecked = (txtblk.Foreground as SolidColorBrush).Color == colors[i], Margin = new Thickness(12) }; radioButton.Checked += OnRadioButtonChecked; stackPanel.Children.Add(radioButton); } // Create a Border for the StackPanel Border border = new Border { Child = stackPanel, Background = this.Resources["ApplicationPageBackgroundThemeBrush"] as SolidColorBrush, BorderBrush = this.Resources["ApplicationForegroundThemeBrush"] as SolidColorBrush, BorderThickness = new Thickness(1), Padding = new Thickness(24), }; // Create the Popup object Popup popup = new Popup { Child = border, IsLightDismissEnabled = true }; // Adjust location based on content size border.Loaded += (loadedSender, loadedArgs) => { Point point = e.GetPosition(this); point.X -= border.ActualWidth / 2; point.Y -= border.ActualHeight; // Leave at least a quarter inch margin popup.HorizontalOffset = Math.Min(this.ActualWidth - border.ActualWidth - 24, Math.Max(24, point.X)); popup.VerticalOffset = Math.Min(this.ActualHeight - border.ActualHeight - 24, Math.Max(24, point.Y)); // Set keyboard focus to first element btn1.Focus(FocusState.Programmatic); }; // Open the popup popup.IsOpen = true; }
private void BuildControl(InputType type, string label, string placeholderText, double labelFontSize, double labelTranslateY, string groupName, ContentControl ccInput) { FrameworkElement fe = null; if (type == InputType.text) { var tb = new TextBox(); tb.PlaceholderText = placeholderText; tb.Style = _GeneralTextBoxStyle; tb.KeyUp += ittext_KeyUp; _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment= VerticalAlignment.Top}; _udfTBL1 = new TextBlock(); _udfTBL1.Text = label; _udfTBL1.FontSize = labelFontSize; _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0); _udfg1.Visibility = Visibility.Collapsed; _udfg1.Children.Add(_udfTBL1); var gd = new Grid(); gd.Children.Add(_udfg1); gd.Children.Add(tb); fe = gd; } else if (type == InputType.password) { var tb = new PasswordBox(); tb.PlaceholderText = placeholderText; tb.Style = _GeneralPasswordBoxStyle; tb.PasswordChanged += itpassword_PasswordChanged; _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; _udfTBL1 = new TextBlock(); _udfTBL1.Text = label; _udfTBL1.FontSize = labelFontSize; _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0); _udfg1.Visibility = Visibility.Collapsed; _udfg1.Children.Add(_udfTBL1); var gd = new Grid(); gd.Children.Add(_udfg1); gd.Children.Add(tb); fe = gd; } else if (type == InputType.checkbox) { var sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; var lb = new TextBlock(); lb.Text = label; lb.FontSize = LabelFontSize; lb.Margin = new Thickness(0, LabelTranslateY, 0, 0); var cb = new CheckBox(); cb.Checked += itcheckbox_Checked; cb.Content = lb; cb.Style = _GeneralCheckBoxStyle; sp.Children.Add(cb); fe = sp; } else if (type == InputType.radio) { var sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; var lb = new TextBlock(); lb.Text = label; lb.FontSize = LabelFontSize; lb.Margin = new Thickness(0, LabelTranslateY, 0, 0); var rb = new RadioButton(); rb.GroupName = groupName; rb.Checked += itradio_Checked; rb.Content = lb; rb.Style = _GeneralRadioButtonStyle; sp.Children.Add(rb); fe = sp; } fe.HorizontalAlignment = HorizontalAlignment.Stretch; fe.VerticalAlignment = VerticalAlignment.Stretch; ccInput.Content = fe; }
private async void Radio_Checked(object sender, RoutedEventArgs e) { ActiveRadio = (RadioButton)sender; if(ActiveRadio == DateRadio) { var dpfo = new DatePickerFlyout(); var result = await dpfo.ShowAtAsync(ContentRoot); PriceRadio.IsChecked = true; if(result.HasValue) DateField.Text = result.Value.DateTime.ToString("d"); } }
private void EnableRadioButton(RadioButton rbn, bool enabled) { rbn.IsEnabled = enabled; if (enabled) rbn.IsChecked = false; }
/// <summary> /// Create RadioButtons /// </summary> /// <param name="number">number of rb</param> private void CreateRB(int number, string ans, int value) { RadioButton rb = new RadioButton(); TextBlock tb = new TextBlock(); tb.Text = ans; tb.TextWrapping = TextWrapping.Wrap; tb.FontSize = 14; rb.Content = tb; rb.TabIndex = number + 1; rb.Tag = value; lv.Items.Add(rb); lv.IsSynchronizedWithCurrentItem.GetValueOrDefault(true); if (number == 0) rb.IsChecked = true; }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _splitView = (SplitView)GetTemplateChild("SplitView"); _splitView.Tag = new RelayCommand<HamburgerItem>(RaiseItemChanged); _hamburgerButton = (RadioButton)GetTemplateChild("HamburgerButton"); _hamburgerButton.Click += OnTogglePane; }
private void GetAssumptionsFlyout() { if (_assumptionsFlyout == null) { Flyout flyout = new Flyout(); // creating some content // this could be just an instance of a UserControl of course Border border = new Border(); ScrollViewer scroll = new ScrollViewer(); scroll.MaxHeight = 600; scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; //scroll.MaxWidth = 400; //b.BorderBrush = new SolidColorBrush(Colors.White); //b.Width = 300; //b.Height = 600; border.BorderThickness = new Thickness(5); border.Margin = new Thickness(-5); Grid assumptionLayoutGrid = new Grid(); assumptionLayoutGrid.Margin = new Thickness(0); int i = 0; ColumnDefinition col = new ColumnDefinition(); assumptionLayoutGrid.ColumnDefinitions.Add(col); foreach (var assumption in Result.Assumptions) { RowDefinition headerRow = new RowDefinition(); RowDefinition body = new RowDefinition(); assumptionLayoutGrid.RowDefinitions.Add(headerRow); assumptionLayoutGrid.RowDefinitions.Add(body); TextBlock assumptionHeaderText = new TextBlock(); assumptionHeaderText.Text = assumption.DescriptionBefore; assumptionHeaderText.FontSize = 26; assumptionHeaderText.Margin = new Thickness(4, 4, 24, 4); Border assumptionHeader = new Border(); assumptionHeader.Child = assumptionHeaderText; assumptionHeader.Background = new SolidColorBrush(Colors.LightGray); assumptionLayoutGrid.Children.Add(assumptionHeader); Grid.SetColumn(assumptionHeader, 0); Grid.SetRow(assumptionHeader, i); StackPanel choicesPanel = new StackPanel(); choicesPanel.Orientation = Orientation.Vertical; choicesPanel.Margin = new Thickness(8, 4, 24, 4); assumptionLayoutGrid.Children.Add(choicesPanel); Grid.SetRow(choicesPanel, i + 1); Grid.SetColumn(choicesPanel, 0); foreach (var choice in assumption.Values) { RadioButton c = new RadioButton(); c.Content = choice; c.GroupName = assumption.GetQueryString(); choicesPanel.Children.Add(c); c.IsChecked = (assumption.SelectedWord == choice); c.Checked += c_Checked; c.DataContext = assumption; } i += 2; } border.Child = scroll; scroll.Content = assumptionLayoutGrid; // set the Flyout content flyout.Content = border; //flyout. //b.Child = container; //filters.Content = b; flyout.PlacementTarget = QueryText; flyout.Placement = Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom; flyout.IsOpen = true; //f.Background = new SolidColorBrush(Colors.Black); _assumptionsFlyout = flyout; } else { _assumptionsFlyout.IsOpen = true; } }
private void BuildControl(InputType type, string label, string placeholderText, double labelFontSize, double labelTranslateY, string groupName, ContentControl ccInput) { FrameworkElement fe = null; if (type == InputType.text) { _udfTB1 = new TextBox(); _udfTB1.PlaceholderText = placeholderText; _udfTB1.Style = _GeneralTextBoxStyle; _udfTB1.SetBinding(TextBox.DataContextProperty, new Binding() { Path= new PropertyPath("{x:Null}") }); _udfTB1.SetBinding(TextBox.TextProperty, new Binding() { Source = Value }); _udfTB1.KeyUp += ittext_KeyUp; _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment= VerticalAlignment.Top}; _udfTBL1 = new TextBlock(); _udfTBL1.Text = label; _udfTBL1.FontSize = labelFontSize; _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0); _udfg1.Visibility = Visibility.Collapsed; _udfg1.Children.Add(_udfTBL1); var gd = new Grid(); gd.Children.Add(_udfg1); gd.Children.Add(_udfTB1); fe = gd; } else if (type == InputType.password) { _udfPB1 = new PasswordBox(); _udfPB1.PlaceholderText = placeholderText; _udfPB1.Style = _GeneralPasswordBoxStyle; _udfPB1.PasswordChanged += itpassword_PasswordChanged; _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; _udfTBL1 = new TextBlock(); _udfTBL1.Text = label; _udfTBL1.FontSize = labelFontSize; _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0); _udfg1.Visibility = Visibility.Collapsed; _udfg1.Children.Add(_udfTBL1); var gd = new Grid(); gd.Children.Add(_udfg1); gd.Children.Add(_udfPB1); fe = gd; } else if (type == InputType.combobox) { _udfCB1 = new ComboBox(); _udfCB1.Style = _GeneralComboBoxStyle; _udfCB1.PlaceholderText = placeholderText; _udfCB1.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Source = Items }); _udfCB1.Width = this.Width; _udfCB1.SelectionChanged += itcombobox_SelectionChanged; _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; _udfTBL1 = new TextBlock(); _udfTBL1.Text = label; _udfTBL1.FontSize = labelFontSize; _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0); _udfg1.Visibility = Visibility.Collapsed; _udfg1.Children.Add(_udfTBL1); var gd = new Grid(); gd.Children.Add(_udfg1); gd.Children.Add(_udfCB1); fe = gd; } else if (type == InputType.checkbox) { var sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; var lb = new TextBlock(); lb.Text = label; lb.FontSize = LabelFontSize; lb.Margin = new Thickness(0, LabelTranslateY, 0, 0); _udfChkB1 = new CheckBox(); _udfChkB1.Checked += itcheckbox_Changed; _udfChkB1.Unchecked += itcheckbox_Changed; _udfChkB1.Content = lb; _udfChkB1.Style = _GeneralCheckBoxStyle; sp.Children.Add(_udfChkB1); fe = sp; } else if (type == InputType.toggleButton) { _udfTBut1 = new ToggleButton(); _udfTBut1.Style = _GeneralToggleButtonStyle; _udfTBut1.Checked += ittogglebutton_changed; _udfTBut1.Unchecked += ittogglebutton_changed; _udfTBut1.FontSize = FontSize; _udfTBut1.Content = Content1; fe = _udfTBut1; } else if (type == InputType.toggleSwitch) { _udfTS1 = new ToggleSwitch(); _udfTS1.Style = _GeneralToggleSwitchStyle; _udfTS1.Toggled += ittoggleswitch_Toggled; _udfTS1.FontSize = FontSize; _udfTS1.OnContent = Content1; _udfTS1.OffContent = Content2; fe = _udfTS1; } else if (type == InputType.radio) { var sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; var lb = new TextBlock(); lb.Text = label; lb.FontSize = LabelFontSize; lb.Margin = new Thickness(0, LabelTranslateY, 0, 0); _udfRB1 = new RadioButton(); _udfRB1.GroupName = groupName; _udfRB1.Checked += itradio_Changed; _udfRB1.Unchecked += itradio_Changed; _udfRB1.Content = lb; _udfRB1.Style = _GeneralRadioButtonStyle; sp.Children.Add(_udfRB1); fe = sp; } else if (type == InputType.progress) { _udfProgBr1 = new ProgressBar(); _udfProgBr1.Style = _GeneralProgressBarStyle; _udfProgBr1.ValueChanged += itProgBr_ValueChanged; _udfProgBr1.FontSize = FontSize; _udfProgBr1.DataContext = this; _udfProgBr1.SetBinding(ProgressBar.MaximumProperty, new Binding() { Path= new PropertyPath("Maximum1") }); _udfProgBr1.SetBinding(ProgressBar.MinimumProperty, new Binding() { Path = new PropertyPath("Minimum1") }); _udfProgBr1.SetBinding(ProgressBar.ValueProperty, new Binding() { Path = new PropertyPath("Value1") }); _udfProgBr1.SetBinding(ProgressBar.SmallChangeProperty, new Binding() { Path = new PropertyPath("SmallChange1") }); _udfProgBr1.SetBinding(ProgressBar.LargeChangeProperty, new Binding() { Path = new PropertyPath("LargeChange1") }); fe = _udfProgBr1; } else if (type == InputType.progressRing) { _udfProgRn1 = new ProgressRing(); _udfProgRn1.Style = _GeneralProgressRingStyle; //_udfProgRn1.val += itProgBr_ValueChanged; _udfProgRn1.FontSize = FontSize; _udfProgRn1.DataContext = this; _udfProgRn1.SetBinding(ProgressRing.IsActiveProperty, new Binding() { Path = new PropertyPath("IsActive") }); fe = _udfProgRn1; } else if (type == InputType.slider) { _udfSl1 = new Slider(); _udfSl1.Style = _GeneralSliderStyle; _udfSl1.ValueChanged += itSl_ValueChanged; _udfSl1.FontSize = FontSize; _udfSl1.DataContext = this; _udfSl1.SetBinding(Slider.MaximumProperty, new Binding() { Path = new PropertyPath("Maximum1") }); _udfSl1.SetBinding(Slider.MinimumProperty, new Binding() { Path = new PropertyPath("Minimum1") }); _udfSl1.SetBinding(Slider.ValueProperty, new Binding() { Path = new PropertyPath("Value1") }); _udfSl1.SetBinding(Slider.SmallChangeProperty, new Binding() { Path = new PropertyPath("SmallChange1") }); _udfSl1.SetBinding(Slider.StepFrequencyProperty, new Binding() { Path = new PropertyPath("SmallChange1") }); _udfSl1.SetBinding(Slider.LargeChangeProperty, new Binding() { Path = new PropertyPath("LargeChange1") }); fe = _udfSl1; } fe.HorizontalAlignment = HorizontalAlignment.Stretch; fe.VerticalAlignment = VerticalAlignment.Stretch; ccInput.Content = fe; }
private void RadioButton_Checked(object sender, RoutedEventArgs e) { RadioButton button = sender as RadioButton; string title = (string)button.Content; Route r = API.ds.Routes.Where(d => d.Title == title).First(); currentRoute = r; currentIndex = buttons.IndexOf(button); if (r.Directions.Count > 1) { directionPanel.Children.Clear(); foreach (Direction d in r.Directions) { RadioButton newButton = new RadioButton(); newButton.Checked+=directionButton_Checked; newButton.Content = d.Title; newButton.GroupName = "Direction"; newButton.Style = Application.Current.Resources["TabRadioButtonStyle"] as Style; newButton.Margin = new Thickness(0, 0, 30, 0); //newButton.IsChecked = true; directionPanel.Children.Add(newButton); } (directionPanel.Children.First() as RadioButton).IsChecked = true; } else { directionPanel.Children.Clear(); currentDirection = r.Directions.First(); stopsList.ItemsSource = r.Stops; } //if ((string)button.Content == "Red") // stopsList.ItemsSource = API.ds.Routes.Where(d => d.Title == "Red").First().Stops; //if ((string)button.Content == "Blue") // stopsList.ItemsSource = API.ds.Routes.Where(d => d.Title == "Blue").First().Stops; //if ((string)button.Content == "Green") // stopsList.ItemsSource = API.ds.Routes.Where(d => d.Title == "Green").First().Stops; //if ((string)button.Content == "Trolley") // stopsList.ItemsSource = API.ds.Routes.Where(d => d.Title == "Tech Trolley").First().Stops; //if ((string)button.Content == "Night") // stopsList.ItemsSource = API.ds.Routes.Where(d => d.Title == "Night").First().Stops; //if ((string)button.Content == "Emory") // stopsList.ItemsSource = API.ds.Routes.Where(d => d.Title == "Emory Shuttle").First().Stops; }
void CheckNavButton(RadioButton navButton, bool manual = true) { if (manual) _navButtonManualChecked = true; if(navButton != null) navButton.IsChecked = true; }
/// <summary> /// Create RadioButtons /// </summary> /// <param name="number">number of rb</param> private void CreateRB(int number, string ans, int value) { RadioButton rb = new RadioButton(); TextBlock tb = new TextBlock(); tb.Text = ans; tb.TextWrapping = TextWrapping.Wrap; tb.FontSize = FontSizeOnPage; tb.Padding = new Thickness(5, 0, 0, 10); #if WINDOWS_PHONE_APP rb.Margin = new Thickness(10, 5, 10, 5); #else tb.Margin = new Thickness(0, (19 - FontSizeOnPage), 0, 0); rb.Margin = new Thickness(5, 10, 5, 10); #endif rb.Content = tb; rb.TabIndex = number; rb.Tag = value; lv.Items.Add(rb); lv.IsSynchronizedWithCurrentItem.GetValueOrDefault(true); }
private void CreateControl() { var grid = new Grid(); int rowIndex = 0; var margin = new Thickness {Top = 24}; grid.Margin = margin; var sketchModeText = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = FilterControlTitleFontSize, Text = _resourceLoader.GetString("SketchMode/Text") }; Grid.SetRow(sketchModeText, rowIndex++); var padding = new Thickness { Left = 12, Right = 12 }; var grayRadioButton = new RadioButton { Padding = padding, GroupName = SketchModeGroup }; var textBlock = new TextBlock { Text = _resourceLoader.GetString("Gray/Text") }; grayRadioButton.Content = textBlock; grayRadioButton.Checked += grayRadioButton_Checked; Grid.SetRow(grayRadioButton, rowIndex++); var colorRadioButton = new RadioButton { Padding = padding, GroupName = SketchModeGroup }; textBlock = new TextBlock { Text = _resourceLoader.GetString("Color/Text") }; colorRadioButton.Content = textBlock; colorRadioButton.Checked += colorRadioButton_Checked; Grid.SetRow(colorRadioButton, rowIndex++); if (_sketchFilter.SketchMode == SketchMode.Gray) { grayRadioButton.IsChecked = true; } else { colorRadioButton.IsChecked = true; } for (int i = 0; i < rowIndex; ++i) { var rowDefinition = new RowDefinition(); if (i == 0) { rowDefinition.MinHeight = FilterControlTitleFontSize; rowDefinition.MaxHeight = FilterControlTitleFontSize; } else if (i < rowIndex - 1) { rowDefinition.MinHeight = GridRowMinimumHeight; rowDefinition.MaxHeight = GridRowMaxHeight; } else { rowDefinition.Height = GridLength.Auto; } grid.RowDefinitions.Add(rowDefinition); } grid.Children.Add(sketchModeText); grid.Children.Add(grayRadioButton); grid.Children.Add(colorRadioButton); Control = grid; }
protected void CreateControl() { var grid = new Grid(); int rowIndex = 0; int columnIndex; var brightnessText = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = FilterControlTitleFontSize, Text = Strings.Brightness }; Grid.SetRow(brightnessText, rowIndex++); var brightnessSlider = new Slider { StepFrequency = 0.01, Minimum = 0.0, Maximum = 1.0, Value = Filter.Brightness }; brightnessSlider.ValueChanged += brightnessSlider_ValueChanged; Grid.SetRow(brightnessSlider, rowIndex++); var saturationText = new TextBlock { VerticalAlignment = VerticalAlignment.Center, FontSize = FilterControlTitleFontSize, Text = Strings.Saturation }; Grid.SetRow(saturationText, rowIndex++); var saturationSlider = new Slider { StepFrequency = 0.01, Minimum = 0.0, Maximum = 1.0, Value = Filter.Saturation }; saturationSlider.ValueChanged += saturationSlider_ValueChanged; Grid.SetRow(saturationSlider, rowIndex++); var margin = new Thickness { Left = 72 }; rowIndex = 0; columnIndex = 1; var lomoVignettingText = new TextBlock { Margin = margin, VerticalAlignment = VerticalAlignment.Center, FontSize = FilterControlTitleFontSize, Text = Strings.LomoVignetting }; Grid.SetRow(lomoVignettingText, rowIndex++); Grid.SetColumn(lomoVignettingText, columnIndex); var highRadioButton = new RadioButton { Margin = margin, GroupName = LomoVignettingGroup, Content = new TextBlock { Text = Strings.High } }; highRadioButton.Checked += highRadioButton_Checked; Grid.SetRow(highRadioButton, rowIndex++); Grid.SetColumn(highRadioButton, columnIndex); var medRadioButton = new RadioButton { Margin = margin, GroupName = LomoVignettingGroup, Content = new TextBlock { Text = Strings.Medium } }; medRadioButton.Checked += medRadioButton_Checked; Grid.SetRow(medRadioButton, rowIndex++); Grid.SetColumn(medRadioButton, columnIndex); var lowRadioButton = new RadioButton { Margin = margin, GroupName = LomoVignettingGroup, Content = new TextBlock { Text = Strings.Low } }; lowRadioButton.Checked += lowRadioButton_Checked; Grid.SetRow(lowRadioButton, rowIndex++); Grid.SetColumn(lowRadioButton, columnIndex); switch (Filter.LomoVignetting) { case LomoVignetting.Low: lowRadioButton.IsChecked = true; break; case LomoVignetting.Medium: medRadioButton.IsChecked = true; break; case LomoVignetting.High: highRadioButton.IsChecked = true; break; } for (int i = 0; i < rowIndex; ++i) { var rowDefinition = new RowDefinition(); if (i < rowIndex - 1) { rowDefinition.MinHeight = GridRowMinimumHeight; } else { rowDefinition.Height = GridLength.Auto; } grid.RowDefinitions.Add(rowDefinition); } grid.ColumnDefinitions.Add(new ColumnDefinition { MaxWidth = 500 }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); grid.Children.Add(brightnessText); grid.Children.Add(brightnessSlider); grid.Children.Add(saturationText); grid.Children.Add(saturationSlider); grid.Children.Add(lomoVignettingText); grid.Children.Add(lowRadioButton); grid.Children.Add(medRadioButton); grid.Children.Add(highRadioButton); Control = grid; }
private void UnloadControl(InputType type) { if (type == InputType.text) { _udfTB1.KeyUp -= ittext_KeyUp; } else if (type == InputType.password) { _udfPB1.PasswordChanged -= itpassword_PasswordChanged; } else if (type == InputType.checkbox) { } else if (type == InputType.radio) { } else if (type == InputType.combobox) { if (_ccInput != null) { var sp = (Grid)_ccInput.Content; var cb = (ComboBox)sp.Children[1]; cb.SelectionChanged -= itcombobox_SelectionChanged; Value2 = null; //if (cb.Items != null && cb.Items.Count > 0) cb.Items.Clear(); //if (cb.ItemsSource != null) cb.ItemsSource = null; } } if (_udfTS1 != null) { _udfTS1.Toggled -= ittoggleswitch_Toggled; } if (_udfProgBr1 != null) { _udfProgBr1.ValueChanged -= itProgBr_ValueChanged; } if (_udfSl1 != null) { _udfSl1.ValueChanged -= itSl_ValueChanged; } if (_udfRB1 != null) { _udfRB1.Checked -= itradio_Changed; _udfRB1.Unchecked -= itradio_Changed; } if (_udfChkB1 != null) { _udfChkB1.Checked -= itcheckbox_Changed; _udfChkB1.Unchecked -= itcheckbox_Changed; } if (_udfTBut1 != null) { _udfTBut1.Checked -= ittogglebutton_changed; _udfTBut1.Unchecked -= ittogglebutton_changed; } if (_udfProgRn1 != null) { _udfProgRn1.IsActive = false; } if (_udfg1 != null) { _udfg1.Children.Clear(); _udfg1 = null; } if (dtInvalidate != null) { dtInvalidate.Stop(); dtInvalidate.Tick += DtInvalidate_Tick; } _sbHideBgLayer?.Stop(); _sbHideBgLayer = null; _sbShowBgLayer?.Stop(); _sbShowBgLayer = null; _udfProgBr1 = null; _udfPB1 = null; _udfTB1 = null; _udfTBL1 = null; _udfCB1 = null; _udfChkB1 = null; _udfRB1 = null; _udfTS1 = null; _udfProgRn1 = null; _udfTBut1 = null; dtInvalidate = null; if (_ccInput != null && _ccInput.Content != null) _ccInput.Content = null; if (_ccInput != null) _ccInput = null; _grdContainer = null; if (_grdRoot != null) { _grdRoot.DataContext = null; _grdRoot = null; } _model = null; hasInitialized = false; }