private void SkinGetterXuanChuan_Loaded(object sender, RoutedEventArgs e) { //double _1 = 0; for (int i = 0; i < Number; i++) { RadioButton rb = new RadioButton(); rb.AddHandler(UIElement.MouseEnterEvent, new MouseEventHandler(Rb_MouseEnter), true); rb.AddHandler(UIElement.MouseLeaveEvent, new MouseEventHandler(Rb_MouseLeave), true); rb.Checked += Rb_Checked; rb.SetResourceReference(RadioButton.StyleProperty, "rdoNavSkin"); if (i == 0) { rb.IsChecked = true; } if (i > 0) { rb.Margin = new Thickness(12, 0, 0, 0); } rb.Tag = i; //_1 = _1 + LeftWidth; sp_navs.Children.Add(rb); } ad = new AyAniDouble(prev); isfirst = true; autoPlay = AyTime.setInterval(1000, () => { if (currplayIndex == (Number - 1)) { //最后1个 currplayIndex = 0; var _1 = sp_navs.Children[currplayIndex.ToInt()]; var _2 = _1 as RadioButton; _2.IsChecked = true; } else { currplayIndex++; var _1 = sp_navs.Children[currplayIndex.ToInt()]; var _2 = _1 as RadioButton; _2.IsChecked = true; } }); }
public void Init(Type enumType, Panel panel, object obj, string property, RoutedEventHandler extraRadioButtonCheckedHandler = null) { bindingObject = obj; propertyName = property; this.enumType = enumType; Array.ForEach((int[])Enum.GetValues(enumType), val => { var button = new RadioButton() { Tag = Enum.GetName(enumType, val), Name = Enum.GetName(enumType, val), Content = GingerCore.General.GetEnumValueDescription(enumType, Enum.GetName(enumType, val)), Margin = new Thickness(5, 5, 0, 0), Style = (Style)TryFindResource("@InputRadioButtonStyle") }; button.AddHandler(Button.ClickEvent, new RoutedEventHandler(RadioButton_Click)); //default handler if (extraRadioButtonCheckedHandler != null) { button.Checked += extraRadioButtonCheckedHandler; //extra handler } panel.Children.Add(button); ObjFieldBinding(button, RadioButton.IsCheckedProperty, obj, property); }); string currentValue = obj.GetType().GetProperty(property)?.GetValue(obj)?.ToString(); string[] radioTitles = Enum.GetNames(enumType); if (!string.IsNullOrEmpty(currentValue)) { int i = 1; foreach (string RB in radioTitles) { if (currentValue.Equals(RB)) { ((RadioButton)panel.Children[i]).IsChecked = true; return; } i++; } } }
private Grid InitReqCustomHelper(Food f, ReqCustom options, int nRow, int rowNumber, string groupName) { Grid cus = new Grid(); cus.Width = double.NaN; cus.Height = options.Options.Length * 20; cus.Margin = new Thickness(10, 10, 10, 10); cus.SetValue(Grid.RowProperty, rowNumber); cus.DataContext = options; cus.DataContext = f; int counter = 0; foreach (Option option in options.Options) { RowDefinition r = new RowDefinition(); r.Height = new GridLength(1, GridUnitType.Star); cus.RowDefinitions.Add(r); RadioButton b = new RadioButton(); b.AddHandler(RadioButton.ClickEvent, new RoutedEventHandler(RadioButtonClicked)); if (counter == 0) { b.IsChecked = true; } b.SetValue(Grid.RowProperty, counter); b.GroupName = groupName; b.DataContext = options; b.Content = option.Name; cus.Children.Add(b); counter += 1; } while (counter < rowNumber) { RowDefinition r = new RowDefinition(); r.Height = new GridLength(1, GridUnitType.Star); cus.RowDefinitions.Add(r); } return(cus); }
protected static void OnItemSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is CRMMenuControl) { var topMenuControl = (CRMMenuControl)d; if (topMenuControl.ItemSource == null) { return; } if (topMenuControl.rootMenuPanel.Children.Count > 0) { topMenuControl.rootMenuPanel.Children.Clear(); } var topMenuGroupName = Guid.NewGuid().ToString(); var topMenuEnumerator = topMenuControl.ItemSource.GetEnumerator(); while (topMenuEnumerator.MoveNext()) { var topMenuButton = new RadioButton() { Style = Application.Current.Resources["topMenuButtonStyle"] as Style, DataContext = topMenuEnumerator.Current, GroupName = topMenuGroupName, Margin = new Thickness(0, 0, 1, 0), Padding = new Thickness(10, 5, 10, 1), HorizontalContentAlignment = HorizontalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; topMenuButton.SetBinding(RadioButton.ContentProperty, new System.Windows.Data.Binding() { Converter = new TopMenuContentValueConverter(), ConverterParameter = topMenuControl.DisplayMemberPath }); topMenuButton.AddHandler(UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(topMenuControl.MenuItemButtonClick), true); topMenuControl.rootMenuPanel.Children.Add(topMenuButton); } } }
/// <summary> /// Generate the Radio Buttons on run time according to the Enum configured under the Action and initilized the checked Radio Button. /// </summary> /// <param name="type">Enum type for setting the titles of the Radio Buttons</param> /// <param name="panel">The Panel Name which the Radio Buttons will be generated in</param> /// <param name="act">The Created Action incstance</param> /// <param name="radioParam">The Field which the current selection will be save</param> /// <param name="extraRadioClickedHandler">The Handler for extra functionality to be implemented under the EditPage</param> public void Init(Type enumType, Panel panel, ActInputValue actValue, RoutedEventHandler extraRadioClickedHandler = null) { mActValue = actValue; Array.ForEach((int[])Enum.GetValues(enumType), val => { var button = new RadioButton() { Tag = Enum.GetName(enumType, val), Name = Enum.GetName(enumType, val), Content = GingerCore.General.GetEnumValueDescription(enumType, Enum.GetName(enumType, val)), Margin = new Thickness(5, 5, 0, 0), Style = (Style)TryFindResource("@InputRadioButtonStyle") }; button.AddHandler(Button.ClickEvent, new RoutedEventHandler(RadioButton_Click)); //default handler if (extraRadioClickedHandler != null) { button.Click += extraRadioClickedHandler; //extra handler } panel.Children.Add(button); }); string currentValue = actValue.Value; string[] radioTitles = Enum.GetNames(enumType); if (!string.IsNullOrEmpty(currentValue)) { int i = 1; foreach (string RB in radioTitles) { if (currentValue.Equals(RB)) { ((RadioButton)panel.Children[i]).IsChecked = true; return; } i++; } } }
private async void RefreshChannels() { await mw.Dispatcher.BeginInvoke((Action)(() => { // get all channel buttons var controls = UIHandler.GetChildren(DiscordSelectorWrapPanel); ChannelRadios = controls.RadioButtons; // get a copy of the DiscordChannels data object var chans = channels.Data.ToList(); List <RadioButton> rbTemp = new List <RadioButton>(); // iterate through each channel for (int i = 0; i < chans.Count(); i++) { // dont display button for channel with id 0 if (chans[i].ChannelId == 0) { continue; } // if the channel button already exists, update it var cr = ChannelRadios.Where(a => a.Name == "rbDiscordCh" + chans[i].ChannelId).FirstOrDefault(); if (cr != null) { if (cr.Content.ToString() != chans[i].ChannelName) { cr.Content = chans[i].ChannelName; rbTemp.Add(cr); } continue; } // update completed. now button creation.. // create the channel button RadioButton rb = new RadioButton(); rb.Name = "rbDiscordCh" + chans[i].ChannelId; rb.Content = chans[i].ChannelName; rb.GroupName = "grpDiscordChannels"; rb.AddHandler(Button.ClickEvent, new RoutedEventHandler(mw.btnDiscordChannel_Checked)); // width binding /* * Binding b = new Binding("Width"); * b.ElementName = "DiscordSelectorWrapPanel"; * b.Path = new PropertyPath(DiscordSelectorWrapPanel.Width); * rb.SetBinding(FrameworkElement.WidthProperty, b); */ // styling Style style = new Style(typeof(RadioButton)); style.BasedOn = (Style)mw.TryFindResource(typeof(ToggleButton)); rb.Style = style; // add button to UI DiscordSelectorWrapPanel.Children.Add(rb); rbTemp.Add(rb); } /* * // if active channel is not set, click the button * if (channels.ActiveChannel == 0) * { * var chan = channels.Data.FirstOrDefault(); * if (chan != null) * { * RadioButton b = rbTemp.Where(a => a.Name == "rbDiscordCh" + chan.ChannelId).FirstOrDefault(); * if (b != null) * { * b.IsChecked = true; * } * } * } */ })); }
/// <summary> /// 具体刷新Tab内容的方法 /// </summary> /// <param name="tab"></param> private void RefreshTabContent(TabItem tab) { //logger.Debug("刷新控件ing"); if (tab.Tag == null) { return; } int index = (int)tab.Tag; var prompts = viewModel.Prompts.Where(it => it.TabIndex == index) .ToList(); Grid grid = new Grid(); ScrollViewer viewer = new ScrollViewer(); viewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; viewer.Content = grid; tab.Content = viewer; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(10) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength() }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(20) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(230) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(220) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(250, GridUnitType.Star) }); StackPanel leftSP = new StackPanel(); leftSP.Margin = new Thickness(5, 0, 30, 0); leftSP.SetValue(Grid.RowProperty, 1); leftSP.SetValue(Grid.ColumnProperty, 1); StackPanel middleSP = new StackPanel(); middleSP.Margin = new Thickness(30, 0, 30, 0); middleSP.SetValue(Grid.RowProperty, 1); middleSP.SetValue(Grid.ColumnProperty, 2); StackPanel rightSP = new StackPanel(); rightSP.Margin = new Thickness(30, 0, 0, 0); rightSP.SetValue(Grid.RowProperty, 1); rightSP.SetValue(Grid.ColumnProperty, 3); grid.Children.Add(leftSP); grid.Children.Add(middleSP); grid.Children.Add(rightSP); for (int i = 0; i < prompts.Count(); i++) { var prompt = prompts[i]; if (prompt.ControlType == ControlType.TextBox || prompt.ControlType == ControlType.UnEditabledTextBox || prompt.ControlType == ControlType.Invisabled) { Label label = new Label(); label.Foreground = getBrushById(prompt.ColorIndex); label.DataContext = prompt; label.SetBinding(Label.ContentProperty, new Binding("Name")); label.SetBinding(Label.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); label.SetBinding(Label.ToolTipProperty, new Binding("HelpMessage")); leftSP.Children.Add(label); TextBox tb = new TextBox(); //tb.MouseDoubleClick += tb_MouseDoubleClick; tb.AddHandler(UIElement.MouseEnterEvent, new RoutedEventHandler(tb_MouseLeftButtonDown), true); tb.DataContext = prompt; tb.SetBinding(TextBox.TextProperty, new Binding("PromptValue") { ValidatesOnExceptions = true, ValidatesOnDataErrors = true, NotifyOnValidationError = true }); tb.SetBinding(TextBox.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); tb.SetBinding(TextBox.IsEnabledProperty, new Binding("IsEnabled")); tb.SetBinding(TextBox.ToolTipProperty, new Binding("HelpMessage")); leftSP.Children.Add(tb); TextBlock error = new TextBlock(); error.Foreground = Brushes.Red; error.DataContext = prompt; error.SetBinding(TextBlock.TextProperty, new Binding("ErrorMessage")); error.SetBinding(Label.VisibilityProperty, new Binding("ErrorMessage") { Converter = new PromptValueToVisibilityConverter() }); leftSP.Children.Add(error); } else if (prompt.ControlType == ControlType.CheckBox) { CheckBox cb = new CheckBox(); cb.Foreground = getBrushById(prompt.ColorIndex); cb.Margin = new Thickness(0, 3, 0, 3); cb.DataContext = prompt; cb.AddHandler(UIElement.MouseEnterEvent, new RoutedEventHandler(tb_MouseLeftButtonDown), true); cb.SetBinding(CheckBox.IsCheckedProperty, new Binding("PromptValue") { Converter = new PromptValueToCheckedConverter() }); cb.SetBinding(CheckBox.ContentProperty, new Binding("Name")); cb.SetBinding(CheckBox.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); cb.SetBinding(CheckBox.ToolTipProperty, new Binding("HelpMessage")); rightSP.Children.Add(cb); } else if (prompt.ControlType == ControlType.ComboBox) { Label label = new Label(); label.Foreground = getBrushById(prompt.ColorIndex); label.DataContext = prompt; label.SetBinding(Label.ContentProperty, new Binding("Name")); label.SetBinding(Label.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); label.SetBinding(Label.ToolTipProperty, new Binding("HelpMessage")); leftSP.Children.Add(label); ComboBox combo = new ComboBox(); combo.Foreground = getBrushById(prompt.ColorIndex); combo.DataContext = prompt; combo.AddHandler(UIElement.MouseEnterEvent, new RoutedEventHandler(tb_MouseLeftButtonDown), true); combo.SetBinding(ComboBox.SelectedValueProperty, new Binding("PromptValue") { Converter = new PromptValueToIntConverter() }); combo.SetBinding(ComboBox.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); combo.SetBinding(ComboBox.ToolTipProperty, new Binding("HelpMessage")); combo.ItemsSource = prompt.ComboBoxItemsString.Split('|'); //DataTemplate dt = new DataTemplate(); //dt.DataType = typeof(string); //FrameworkElementFactory spFactory = new FrameworkElementFactory(typeof(TextBlock)); leftSP.Children.Add(combo); } else if (prompt.ControlType == ControlType.RadioButton) { GroupBox gb = new GroupBox(); gb.Foreground = getBrushById(prompt.ColorIndex); gb.DataContext = prompt; gb.SetBinding(GroupBox.HeaderProperty, new Binding("Tip")); gb.SetBinding(GroupBox.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); middleSP.Children.Add(gb); StackPanel spinsder = new StackPanel(); gb.Content = spinsder; RadioButton rb = new RadioButton(); rb.Foreground = getBrushById(prompt.ColorIndex); rb.Margin = new Thickness(0, 5, 0, 5); rb.DataContext = prompt; rb.AddHandler(UIElement.MouseEnterEvent, new RoutedEventHandler(tb_MouseLeftButtonDown), true); rb.SetBinding(RadioButton.ContentProperty, new Binding("Name")); rb.SetBinding(RadioButton.IsCheckedProperty, new Binding("PromptValue") { Converter = new PromptValueToCheckedConverter() }); rb.SetBinding(RadioButton.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); spinsder.Children.Add(rb); for (int x = i + 1; x < prompts.Count; x++) { var nextPrompt = prompts[x]; if (nextPrompt.ControlType != ControlType.OtherRadioButton) { break; } RadioButton rb2 = new RadioButton(); rb2.Foreground = getBrushById(prompt.ColorIndex); rb2.Margin = new Thickness(0, 5, 0, 5); rb2.DataContext = nextPrompt; rb2.AddHandler(UIElement.MouseEnterEvent, new RoutedEventHandler(tb_MouseLeftButtonDown), true); rb2.SetBinding(RadioButton.ContentProperty, new Binding("Name")); rb2.SetBinding(RadioButton.IsCheckedProperty, new Binding("PromptValue") { Converter = new PromptValueToCheckedConverter() }); rb2.SetBinding(RadioButton.VisibilityProperty, new Binding("Visible") { Converter = new PromptValueToVisibilityConverter() }); spinsder.Children.Add(rb2); } } } }
// Setting panel for DES Algorithm #region SYMETRIC_ALG_INTERFACE private void AlgDraw(ref StackPanel sP, int panel) { switch (panel) { case 0: sP.Margin = new Thickness(20, 0, 0, 0); dynamic keyField; if (Encryption.algParams[0] == 0) { keyField = new Button() { Style = Resources["GenerateButton"] as Style, Margin = new Thickness(0, 5, 0, 5), Width = 347, Content = "Згенерувати ключ" }; keyField.AddHandler(Button.ClickEvent, new RoutedEventHandler(GenerateRng)); } else { keyField = new PasswordBox() { Style = Resources["MainPasswordBox"] as Style, Width = 347, Margin = new Thickness(0, 5, 0, 5) }; keyField.AddHandler(PasswordBox.LostFocusEvent, new RoutedEventHandler(GeneratePass)); } sP.Children.Add(keyField); break; case 1: sP.Margin = new Thickness(20, 0, 0, 0); var rngType = new RadioButton() { Width = 330, Style = Resources["MainRadioButton"] as Style, Margin = new Thickness(0, 5, 0, 0), GroupName = "keyType", IsChecked = Encryption.algParams[0] == 0 ? true : false }; rngType.AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(KeyTypeRng)); var rngTypeText = new TextBlock() { Style = Resources["TextBlock"] as Style, Text = "Ключ з криптографічного генератора псевдовипадкових послідовностей" }; var passType = new RadioButton() { Width = 330, Style = Resources["MainRadioButton"] as Style, Margin = new Thickness(0, 10, 0, 10), GroupName = "keyType", IsChecked = Encryption.algParams[0] == 1 ? true : false }; passType.AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(KeyTypePass)); var passTypeText = new TextBlock() { Style = Resources["TextBlock"] as Style, Text = "Ключ генерується розширенням паролю" }; rngType.Content = rngTypeText; passType.Content = passTypeText; sP.Children.Add(rngType); sP.Children.Add(passType); break; case 2: sP.Margin = new Thickness(20, 0, 0, 0); var elements = new UIElement[3, 2] { { new Label() { Style = Resources["ParamLabel"] as Style, Content = "Розмір блока (біт):" }, Element(0) }, { new Label() { Style = Resources["ParamLabel"] as Style, Content = "Довжина ключа (біт):" }, Element(1) }, { new Label() { Style = Resources["ParamLabel"] as Style, Content = "Кількість раундів:" }, Element(2) } }; for (int i = 0; i < elements.GetLength(0); i++) { var wPc = new WrapPanel(); wPc.Children.Add(elements[i, 0]); wPc.Children.Add(elements[i, 1]); sP.Children.Add(wPc); } break; } }
// Setting panel for Transposition Algorithm #region TRANSPOSITION_ALG_INTERFACE private void TranspositionDraw(ref StackPanel sP, int panel) { switch (panel) { case 0: int bytesPerPixel = Encryption.CountBytesPerPixel(uploadedImg.Source as BitmapSource); if (Encryption.algParams[0] == 0) { var generateAllBtn = new Button() { Style = Resources["GenerateButton"] as Style, Margin = new Thickness(0, 5, 0, 0), Width = 240, Content = "Згенерувати все", Name = "allRng", Uid = Encryption.CountBytesPerPixel(uploadedImg.Source as BitmapSource).ToString() }; generateAllBtn.AddHandler(Button.ClickEvent, new RoutedEventHandler(GenerateRng)); sP.Children.Add(generateAllBtn); } List <WrapPanel> wPs = new List <WrapPanel>(); List <Brush> colors = new List <Brush>(); List <string> genLabels = new List <string>(); if (bytesPerPixel == 1) { wPs.Add(new WrapPanel()); colors.Add((SolidColorBrush) new BrushConverter().ConvertFrom("#BDBDBD")); genLabels.Add("Gray"); } else { wPs.AddRange(new[] { new WrapPanel(), new WrapPanel(), new WrapPanel() }); colors.AddRange(new[] { (SolidColorBrush) new BrushConverter().ConvertFrom("#f44336"), (SolidColorBrush) new BrushConverter().ConvertFrom("#4CAF50"), (SolidColorBrush) new BrushConverter().ConvertFrom("#2196F3") }); genLabels.AddRange(new[] { "Red", "Green", "Blue" }); } int color = 0; foreach (WrapPanel wP in wPs) { wP.Style = Resources["WrapPanel"] as Style; wP.Margin = new Thickness(0, 10, 0, 0); var colorRect = new Rectangle() { Style = Resources["ColorRectangle"] as Style, Fill = colors[color] }; wP.Children.Add(colorRect); if (Encryption.algParams[3] == 1) { dynamic generateField; if (Encryption.algParams[0] == 0) { generateField = new Button() { Style = Resources["GenerateButton"] as Style, Width = 347, Margin = new Thickness(5, 0, 0, 0), Content = "Генерація для " + genLabels[color], Name = genLabels[color] + "Rng", Uid = "0" }; generateField.AddHandler(Button.ClickEvent, new RoutedEventHandler(GenerateRng)); } else { generateField = new PasswordBox() { Style = Resources["MainPasswordBox"] as Style, Width = 347, Margin = new Thickness(5, 0, 0, 0), Name = genLabels[color] + "Pass", Uid = "0" }; generateField.AddHandler(PasswordBox.LostFocusEvent, new RoutedEventHandler(GeneratePass)); } wP.Children.Add(generateField); } else { string[] labels = new string[] { "Генерація для рядків", "Генерація для стовпців" }; for (int i = 0; i < labels.Length; i++) { dynamic generateField; if (Encryption.algParams[0] == 0) { generateField = new Button() { Style = Resources["GenerateButton"] as Style, Margin = new Thickness(5, 0, 0, 0), Width = 171, Content = labels[i], Name = genLabels[color] + "Rng", Uid = i.ToString() }; generateField.AddHandler(Button.ClickEvent, new RoutedEventHandler(GenerateRng)); } else { generateField = new PasswordBox() { Style = Resources["MainPasswordBox"] as Style, Margin = new Thickness(5, 0, 0, 0), Width = 171, Name = genLabels[color] + "Pass", Uid = i.ToString() }; generateField.AddHandler(PasswordBox.LostFocusEvent, new RoutedEventHandler(GeneratePass)); } wP.Children.Add(generateField); } } sP.Children.Add(wP); color++; } break; case 1: sP.Margin = new Thickness(20, 0, 0, 0); var rngType = new RadioButton() { Width = 330, Style = Resources["MainRadioButton"] as Style, Margin = new Thickness(0, 5, 0, 0), GroupName = "keyType", IsChecked = Encryption.algParams[0] == 0 ? true : false }; rngType.AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(KeyTypeRng)); var rngTypeText = new TextBlock() { Style = Resources["TextBlock"] as Style, Text = "Ключ з криптографічного генератора псевдовипадкових послідовностей", }; var passType = new RadioButton() { Width = 330, Style = Resources["MainRadioButton"] as Style, Margin = new Thickness(0, 10, 0, 10), GroupName = "keyType", IsChecked = Encryption.algParams[0] == 1 ? true : false }; passType.AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(KeyTypePass)); var passTypeText = new TextBlock() { Style = Resources["TextBlock"] as Style, Text = "Ключ генерується розширенням паролю" }; var inBlocks = new CheckBox() { Style = Resources["MainCheckBox"] as Style, Content = "Перестановки в середині блока", Margin = new Thickness(0, 5, 0, 0), IsChecked = Encryption.algParams[1] == 1 ? true : false }; inBlocks.AddHandler(CheckBox.ClickEvent, new RoutedEventHandler(InBlockEncription)); rngType.Content = rngTypeText; passType.Content = passTypeText; sP.Children.Add(rngType); sP.Children.Add(passType); sP.Children.Add(inBlocks); break; case 2: sP.Margin = new Thickness(20, 0, 0, 0); var label = new Label() { Style = Resources["ParamLabel"] as Style, Content = "Розміри блока:" }; List <string> cBItems = new List <string>() { "256", "128", "64", "32", "16" }; var comboBox = new ComboBox() { Width = 100, Margin = new Thickness(5, 0, 0, 0), ItemsSource = cBItems, SelectedIndex = cBItems.IndexOf(Encryption.algParams[2].ToString()) }; comboBox.AddHandler(ComboBox.SelectionChangedEvent, new RoutedEventHandler(BlockSize)); var wPc = new WrapPanel(); wPc.Children.Add(label); wPc.Children.Add(comboBox); sP.Children.Add(wPc); var rowType = new RadioButton() { Style = Resources["MainRadioButton"] as Style, Margin = new Thickness(0, 5, 0, 0), GroupName = "chipherType", IsChecked = Encryption.algParams[3] == 1 ? true : false }; rowType.AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(ChipherType1D)); var rowTypeText = new TextBlock() { Style = Resources["TextBlock"] as Style, Text = "Режим одномірного шифрування" }; var colType = new RadioButton() { Style = Resources["MainRadioButton"] as Style, Margin = new Thickness(0, 10, 0, 10), GroupName = "chipherType", IsChecked = Encryption.algParams[3] == 2 ? true : false }; var colTypeText = new TextBlock() { Style = Resources["TextBlock"] as Style, Text = "Режим двомірного шифрування" }; colType.AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(ChipherType2D)); rowType.Content = rowTypeText; colType.Content = colTypeText; sP.Children.Add(rowType); sP.Children.Add(colType); break; } }