private Grid CreateGrid(string aParameterName, Property aProperty) { try { Grid _result = new Grid(); _result.Width = double.NaN; ColumnDefinition _cd1 = new ColumnDefinition(); //cd1.Width = new GridLength(1,GridUnitType.Auto); _result.ColumnDefinitions.Add(_cd1); ColumnDefinition _cd2 = new ColumnDefinition(); //cd2.Width = new GridLength(1, GridUnitType.Auto); _result.ColumnDefinitions.Add(_cd2); TextBlock _tblk = new TextBlock(); _tblk.FontFamily = new FontFamily("Segoe UI"); _tblk.FontWeight = FontWeights.Bold; //tblk.FontSize = 14; _tblk.Text = aParameterName; _tblk.Margin = new Thickness(5, 10, 2, 0); Grid.SetColumn(_tblk, 0); _result.Children.Add(_tblk); InControl _InControl = new InControl(); if (!aProperty.IsMultipleSelection) { TextBox _tbx = new TextBox(); _tbx.Tag = aProperty; _tbx.HorizontalAlignment = HorizontalAlignment.Right; _tbx.Width = 50; _tbx.Text = "1"; _tbx.Margin = new Thickness(0, 10, 10, 0); Grid.SetColumn(_tbx, 1); _InControl.TextBox = _tbx; _InControl.ControlType = ControlType.TextBox; _result.Children.Add(_tbx); } else { RadComboBox _combbx = new RadComboBox(); _combbx.ItemsSource = aProperty.Value_Converters; _combbx.DisplayMemberPath = "Value"; _combbx.SelectedIndex = 0; _combbx.Tag = aProperty; _combbx.Margin = new Thickness(0, 10, 10, 0); _combbx.HorizontalAlignment = HorizontalAlignment.Right; Grid.SetColumn(_combbx, 1); _InControl.ComboBox = _combbx; _InControl.ControlType = ControlType.ComboBox; _result.Children.Add(_combbx); } if (InTextBoxs != null) InTextBoxs.Add(_InControl); return _result; } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); return null; } }
public static Grid CreateGrid(IOneVisualizer aIOV, string aParameterName, Property aProperty) { Grid _result = new Grid(); _result.Width = double.NaN; ColumnDefinition _cd1 = new ColumnDefinition(); //cd1.Width = new GridLength(1,GridUnitType.Auto); _result.ColumnDefinitions.Add(_cd1); ColumnDefinition _cd2 = new ColumnDefinition(); //cd2.Width = new GridLength(1, GridUnitType.Auto); _result.ColumnDefinitions.Add(_cd2); TextBlock _tblk = new TextBlock(); _tblk.FontFamily = new FontFamily("Segoe UI"); _tblk.FontWeight = FontWeights.Bold; //tblk.FontSize = 14; _tblk.Text = aParameterName; _tblk.Margin = new Thickness(10, 10, 5, 0); Grid.SetColumn(_tblk, 0); _result.Children.Add(_tblk); InControl _InControl = new InControl(); if (!aProperty.IsMultipleSelection) { TextBox _tbx = new TextBox(); _tbx.Tag = aProperty; _tbx.HorizontalAlignment = HorizontalAlignment.Right; _tbx.Width = 50; _tbx.Text = "1"; _tbx.Margin = new Thickness(0, 10, 10, 0); Grid.SetColumn(_tbx, 1); _InControl.TextBox = _tbx; _InControl.ControlType = ControlType.TextBox; _result.Children.Add(_tbx); } else { RadComboBox _combbx = new RadComboBox(); StyleManager.SetTheme(_combbx, new Office_BlueTheme()); _combbx.ItemsSource = aProperty.Value_Converters; _combbx.DisplayMemberPath = "Value"; _combbx.SelectedIndex = 0; _combbx.Tag = aProperty; _combbx.Margin = new Thickness(0, 10, 10, 0); _combbx.HorizontalAlignment = HorizontalAlignment.Right; Grid.SetColumn(_combbx, 1); _InControl.ComboBox = _combbx; _InControl.ControlType = ControlType.ComboBox; _result.Children.Add(_combbx); } if (aIOV.InControls != null) aIOV.InControls.Add(_InControl); return _result; }