private void textControl1_TextFieldClicked(object sender, TXTextControl.TextFieldEventArgs e) { // cast the field to an ApplicationField ApplicationField field = e.TextField as ApplicationField; if (field != null) { // check whether the field is a checkbox field if ((field.TypeName == "FORMCHECKBOX")) { // create a new adapter field FormCheckBox chkb = new FormCheckBox(field); if (chkb.Enabled == false) { return; } // change the checked state if (field.Text == UNCHECKED) { chkb.Checked = true; chkb.Text = CHECKED; } else if (field.Text == CHECKED) { chkb.Checked = false; chkb.Text = UNCHECKED; } } } }
public void SetFields() { // loop through all fields to activate the checkbox fields foreach (TXTextControl.ApplicationField appfield in textControl1.ApplicationFields) { if ((appfield.TypeName != "FORMCHECKBOX")) { return; } // create a new adapter field FormCheckBox ChkBoxField = new FormCheckBox(appfield); // select the field to change the font name textControl1.Select(ChkBoxField.Start - 1, ChkBoxField.Length); textControl1.Selection.FontName = "Arial Unicode MS"; // set the text (state) if (ChkBoxField.Checked == true) { ChkBoxField.Text = CHECKED; } else { ChkBoxField.Text = UNCHECKED; } textControl1.Select(0, 0); } }
private byte[] processFormCheckBoxFields(byte[] document, DataRow dataRow) { using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { tx.Create(); tx.Load(document, TXTextControl.BinaryStreamType.InternalUnicodeFormat); foreach (IFormattedText textPart in tx.TextParts) { foreach (ApplicationField appField in textPart.ApplicationFields) { if (appField.TypeName == "FORMCHECKBOX") { FormCheckBox checkbox = new FormCheckBox(appField); if (dataRow.Table.Columns[checkbox.Name] != null) { checkbox.Checked = Convert.ToBoolean(dataRow[checkbox.Name]); } } } } byte[] data; tx.Save(out data, BinaryStreamType.InternalUnicodeFormat); return(data); } }
public virtual void Visit(FormCheckBox formCheckBox) { if (values[formCheckBox.Path] == null) { formCheckBox.Content = false; return; } formCheckBox.Content = values[formCheckBox.Path].ToLower() == "on"; }
private List <AbstractFormElement> MapDocumentConstructingExpressions(List <string> constructingExpressions) { if (constructingExpressions != null && constructingExpressions.Count > 0) { List <AbstractFormElement> constructingElements = new List <AbstractFormElement>(); foreach (string item in constructingExpressions) { string[] splitedExpression = item.Replace("{{options:", string.Empty).Replace("#}}", string.Empty).Split('#'); string name = splitedExpression[0]; if (splitedExpression.Length < 3) { FormCheckBox checkBox = new FormCheckBox(); checkBox.Name = name; checkBox.Expression = item; checkBox.Text = splitedExpression[1]; checkBox.IsChecked = false; constructingElements.Add(checkBox); } else if (splitedExpression.Where((x, index) => index > 0).Where(s => s.Length > 50).Count() > 0) { FormRadioButton comboBox = new FormRadioButton(); comboBox.Name = name; comboBox.Expression = item; for (int i = 1; i < splitedExpression.Length; i++) { comboBox.Options.Add(splitedExpression[i]); } comboBox.SelectedIndex = 0; constructingElements.Add(comboBox); } else { FormDropDown dropDown = new FormDropDown(); dropDown.Name = name; dropDown.Expression = item; for (int i = 1; i < splitedExpression.Length; i++) { dropDown.Options.Add(splitedExpression[i]); } dropDown.SelectedIndex = 0; constructingElements.Add(dropDown); } } return(constructingElements); } return(null); }
private void formCheckBoxToolStripMenuItem_Click(object sender, EventArgs e) { // create a new FormCheckBox field and add it to TextControl FormCheckBox fcbField = new FormCheckBox(); fcbField.Checked = false; fcbField.Text = fcbField.Checked == true ? CHECKED : UNCHECKED; fcbField.ApplicationField.Deleteable = false; fcbField.ApplicationField.Editable = false; fcbField.ApplicationField.DoubledInputPosition = true; textControl1.ApplicationFields.Add(fcbField.ApplicationField); }
public void SetFields() { byte[] binaryDocument = null; // LoadSettings must be adjusted to load the MS Word fields TXTextControl.LoadSettings ls = new LoadSettings(); ls.ApplicationFieldFormat = ApplicationFieldFormat.MSWord; // save the document to the variable textControl1.Save(out binaryDocument, BinaryStreamType.InternalUnicodeFormat); // create a ServerTextControl instance to convert the checkboxes using( TXTextControl.ServerTextControl serverTextControl = new ServerTextControl() ) { serverTextControl.Create(); // load the document from the variable serverTextControl.Load(binaryDocument, TXTextControl.BinaryStreamType.InternalUnicodeFormat, ls); // loop through all fields to activate the checkbox fields foreach (TXTextControl.ApplicationField appfield in serverTextControl.ApplicationFields) { if ((appfield.TypeName == "FORMCHECKBOX")) { // create a new adapter field FormCheckBox ChkBoxField = new FormCheckBox(appfield); // select the field to change the font name serverTextControl.Select(ChkBoxField.Start - 1, ChkBoxField.Length); serverTextControl.Selection.FontName = "Arial Unicode MS"; // set the text (state) if (ChkBoxField.Checked == true) ChkBoxField.Text = CHECKED; else ChkBoxField.Text = UNCHECKED; } } // save the document back to the variable serverTextControl.Save(out binaryDocument, BinaryStreamType.InternalUnicodeFormat); // load the document back into the TextControl to show it to the user textControl1.Load(binaryDocument, BinaryStreamType.InternalUnicodeFormat, ls); } }
private HtmlLabel CreateCheckBox(FormCheckBox formCheckBox) { HtmlLabel htmlLabel = new HtmlLabel(); htmlLabel.Class.AddRange(new string[] { "switch", "switch-default", "switch-pill", "switch-primary", "ml-2" }); HtmlCheckBox htmlCheckBox = new HtmlCheckBox(formCheckBox.Path); htmlCheckBox.Class.Add("switch-input"); htmlCheckBox.Disabled.Value = formCheckBox.IsDisabled; htmlCheckBox.Checked.Value = formCheckBox.Value; htmlLabel.Add(htmlCheckBox); HtmlSpan htmlSpan = new HtmlSpan(); htmlSpan.Class.Add("switch-label"); htmlLabel.Add(htmlSpan); htmlSpan = new HtmlSpan(); htmlSpan.Class.Add("switch-handle"); htmlLabel.Add(htmlSpan); return(htmlLabel); }
public virtual void Visit(FormCheckBox formCheckBox) { sb.AppendLine(string.Format("{0}{1}: {2}", formCheckBox.Label, Mark(formCheckBox), formCheckBox.Value ? yes : no)); }
private void textControl1_TextFieldClicked(object sender, TXTextControl.TextFieldEventArgs e) { // cast the field to an ApplicationField ApplicationField field = e.TextField as ApplicationField; if (field != null) { // check whether the field is a checkbox field if ((field.TypeName == "FORMCHECKBOX")) { // create a new adapter field FormCheckBox chkb = new FormCheckBox(field); if (chkb.Enabled == false) return; // change the checked state if (field.Text == UNCHECKED) { chkb.Checked = true; chkb.Text = CHECKED; } else if (field.Text == CHECKED) { chkb.Checked = false; chkb.Text = UNCHECKED; } } } }
public virtual void Visit(FormCheckBox formCheckBox, HtmlContainer htmlContainer) { HtmlDiv htmlDiv = verbose ? new HtmlDiv(formCheckBox.Path) : new HtmlDiv(); htmlDiv.Class.Add("formCheckBox"); if (!string.IsNullOrWhiteSpace(formCheckBox.CssClass)) { htmlDiv.Class.AddRange(formCheckBox.CssClass.Split(' ').Where(s => s != string.Empty)); } if (!string.IsNullOrWhiteSpace(formCheckBox.Path)) { htmlDiv.Class.Add(string.Format("{0}{1}", "formId", formCheckBox.Path)); } htmlDiv.Class.Add("formField"); if (initialize) { htmlDiv.Class.Add(formCheckBox.IsRequired ? "formRequired" : "formOptional"); } else { if (!formCheckBox.IsRequired || formCheckBox.Value) { htmlDiv.Class.Add("formValid"); } else { htmlDiv.Class.Add(formCheckBox.IsRequired ? "formNotEntered" : "formOptional"); } } htmlDiv.Hidden.Value = formCheckBox.IsHidden; htmlContainer.Add(htmlDiv); HtmlCheckBox htmlCheckBox = new HtmlCheckBox(formCheckBox.Path); htmlCheckBox.Disabled.Value = formCheckBox.IsDisabled; htmlCheckBox.Checked.Value = formCheckBox.Value; if (!initialize && firstInvalidId == null) { if (formCheckBox.IsRequired && !formCheckBox.HasValue || !formCheckBox.IsValid) { firstInvalidId = htmlCheckBox.Id.Value; } } switch (formCheckBox.OrderElements) { case OrderElements.LabelMarkInput: AddLabelMark(formCheckBox, htmlCheckBox, htmlDiv); htmlDiv.Add(htmlCheckBox); break; case OrderElements.MarkLabelInput: AddMarkLabel(formCheckBox, htmlCheckBox, htmlDiv); htmlDiv.Add(htmlCheckBox); break; case OrderElements.InputLabelMark: htmlDiv.Add(htmlCheckBox); AddLabelMark(formCheckBox, htmlCheckBox, htmlDiv); break; case OrderElements.InputMarkLabel: htmlDiv.Add(htmlCheckBox); AddMarkLabel(formCheckBox, htmlCheckBox, htmlDiv); break; case OrderElements.LabelInputMark: AddLabel(formCheckBox, htmlCheckBox, htmlDiv); htmlDiv.Add(htmlCheckBox); AddMark(formCheckBox, htmlCheckBox, htmlDiv); break; case OrderElements.MarkInputLabel: AddMark(formCheckBox, htmlCheckBox, htmlDiv); htmlDiv.Add(htmlCheckBox); AddLabel(formCheckBox, htmlCheckBox, htmlDiv); break; default: case OrderElements.NotSet: break; } if (initialize) { return; } string message = null; if (formCheckBox.UseLastMessage) { if (!string.IsNullOrEmpty(formCheckBox.LastMessage)) { message = formCheckBox.LastMessage; } } else if (formCheckBox.IsRequired && !formCheckBox.Value) { message = formCheckBox.RequiredMessage; } else if (!formCheckBox.IsValid) { message = formCheckBox.ValidationMessage; } if (message == null) { return; } HtmlLabel htmlLabelMessage = new HtmlLabel(verbose ? string.Format("{0}{1}", formCheckBox.Path, "Message") : ""); htmlLabelMessage.Class.Add("formValidationMessage"); htmlLabelMessage.For.Value = htmlCheckBox.Id.Value; htmlLabelMessage.Add(new HtmlText(formCheckBox.RequiredMessage)); htmlDiv.Add(htmlLabelMessage); }
/******************************************************** * ToggleCheckBox method * desc: toggles a specific checkbox field * parameter: fieldname - the name of the field ********************************************************/ private void ToggleCheckBox(string fieldName) { byte[] data; // create a new temporary ServerTextControl using (TXTextControl.ServerTextControl tx = new ServerTextControl()) { tx.Create(); // save current document from the editor and load // it into the ServerTextControl TextControl1.SaveText(out data, TXTextControl.Web.BinaryStreamType.InternalUnicodeFormat); tx.Load(data, BinaryStreamType.InternalUnicodeFormat); // loop through all ApplicationFields in each TextPart foreach (IFormattedText textPart in tx.TextParts) { foreach (ApplicationField field in textPart.ApplicationFields) { if ((field.TypeName != "FORMCHECKBOX")) continue; // if the field is a checkbox and the name matches // toggle the Checked property if (field.Name == fieldName) { // create a new adapter field FormCheckBox checkboxField = new FormCheckBox(field); checkboxField.Checked = !checkboxField.Checked; } } } tx.Save(out data, BinaryStreamType.InternalUnicodeFormat); } // process the fields and load the document back into the editor TextControl1.LoadTextAsync(ProcessCheckboxFields(data), TXTextControl.Web.BinaryStreamType.InternalUnicodeFormat); }
/******************************************************** * ProcessCheckboxFields method * desc: Sets the Unicode characters for all * checkbox fields * parameter: document - the document in the internal * Text Control format ********************************************************/ private byte[] ProcessCheckboxFields(byte[] document) { // create a new temporary ServerTextControl using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { // load the document tx.Create(); tx.Load(document, TXTextControl.BinaryStreamType.InternalUnicodeFormat); // loop through all ApplicationFields foreach (IFormattedText textPart in tx.TextParts) { foreach (ApplicationField field in textPart.ApplicationFields) { if ((field.TypeName != "FORMCHECKBOX")) return null; // create a new adapter field FormCheckBox checkboxField = new FormCheckBox(field); // select the field to change the font name textPart.Selection.Start = checkboxField.Start - 1; textPart.Selection.Length = checkboxField.Length; textPart.Selection.FontName = "Arial Unicode MS"; checkboxField.Text = checkboxField.Checked == true ? CHECKED : UNCHECKED; } } tx.Save(out document, BinaryStreamType.InternalUnicodeFormat); return document; } }
private void ApplicationFieldActivate(TXTextControl.ApplicationField ApplicationField) { // remove all child controls textControl1.Controls.Clear(); // check the field type in order to display the proper control switch (ApplicationField.TypeName) { case "FORMDROPDOWN": // create a FormDropDown field FormDropDown fddField = new FormDropDown(ApplicationField); // create a new System.Windows.Forms.ComboBox and add the // FormDropDown's items ComboBox cb = new ComboBox(); cb.Items.AddRange(fddField.ListEntries.ToArray <string>()); Point cbLocation = new Point((fddField.ApplicationField.Bounds.Location.X - textControl1.ScrollLocation.X) / dpiX, (fddField.ApplicationField.Bounds.Location.Y - textControl1.ScrollLocation.Y) / dpiX); cb.Location = cbLocation; cb.Tag = fddField; cb.SelectedText = fddField.ApplicationField.Text; cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged); cb.LostFocus += new EventHandler(cb_LostFocus); // show the ComboBox on top of TextControl textControl1.Controls.Add(cb); cb.Focus(); break; case "FORMCHECKBOX": // create a FormCheckBox field FormCheckBox fcbField = new FormCheckBox(ApplicationField); fcbField.Checked = !fcbField.Checked; // change the text according to the current state fcbField.Text = fcbField.Checked == true ? CHECKED : UNCHECKED; break; case "DATE": // create a DateField field DateField dField = new DateField(ApplicationField); // create a new System.Windows.Forms.DateTimePicker and set the // date to the current DateField date DateTimePicker dtPicker = new DateTimePicker(); dtPicker.Tag = dField; dtPicker.Value = DateTime.Parse(dField.Text); Point dtpLocation = new Point((dField.ApplicationField.Bounds.Location.X - textControl1.ScrollLocation.X) / dpiX, (dField.ApplicationField.Bounds.Location.Y - textControl1.ScrollLocation.Y) / dpiX); dtPicker.Location = dtpLocation; dtPicker.ValueChanged += new EventHandler(dtPicker_ValueChanged); dtPicker.LostFocus += new EventHandler(dtPicker_LostFocus); // show the DateTimePicker on top of TextControl textControl1.Controls.Add(dtPicker); dtPicker.Focus(); break; case "FORMTEXT": // create a FormText field FormText ftField = new FormText(ApplicationField); // create a new System.Windows.Forms.TextBox and set the // text to the current FormText text TextBox tb = new TextBox(); tb.Text = ftField.Text; ftField.Text = ""; Point tbLocation = new Point((ftField.ApplicationField.Bounds.Location.X - textControl1.ScrollLocation.X) / dpiX, (ftField.ApplicationField.Bounds.Location.Y - textControl1.ScrollLocation.Y) / dpiX); tb.Location = tbLocation; tb.Tag = ftField; tb.LostFocus += new EventHandler(tb_LostFocus); tb.KeyPress += new KeyPressEventHandler(tb_KeyPress); tb.SelectAll(); // show the TextBox on top of TextControl textControl1.Controls.Add(tb); tb.Focus(); break; } }
public List <UIElement> BuildUIElements(List <AbstractFormElement> list) { Thickness defaultMargin = new Thickness(20, 5, 20, 5); List <UIElement> uiList = new List <UIElement>(); foreach (var item in list) { if (item is FormCheckBox) { FormCheckBox formCheckBox = item as FormCheckBox; Grid grid = new Grid(); ColumnDefinition columnDefinition1 = new ColumnDefinition(); columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star); ColumnDefinition columnDefinition2 = new ColumnDefinition(); columnDefinition2.Width = new GridLength(1.0, GridUnitType.Star); grid.ColumnDefinitions.Add(columnDefinition1); grid.ColumnDefinitions.Add(columnDefinition2); CheckBox checkBox = new CheckBox(); checkBox.Margin = defaultMargin; Binding isChecked = new Binding("IsChecked"); isChecked.Source = formCheckBox; isChecked.Mode = BindingMode.TwoWay; checkBox.SetBinding(CheckBox.IsCheckedProperty, isChecked); TextBlock textBlock = new TextBlock(); textBlock.TextWrapping = TextWrapping.Wrap; textBlock.Text = formCheckBox.Text; checkBox.Content = textBlock; Grid.SetColumnSpan(checkBox, 2); grid.Children.Add(checkBox); uiList.Add(grid); } if (item is FormDropDown) { FormDropDown formDropDown = item as FormDropDown; Grid grid = new Grid(); ColumnDefinition columnDefinition1 = new ColumnDefinition(); columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star); ColumnDefinition columnDefinition2 = new ColumnDefinition(); columnDefinition2.Width = new GridLength(2.0, GridUnitType.Star); grid.ColumnDefinitions.Add(columnDefinition1); grid.ColumnDefinitions.Add(columnDefinition2); grid.HorizontalAlignment = HorizontalAlignment.Stretch; grid.VerticalAlignment = VerticalAlignment.Stretch; TextBlock textBlock = new TextBlock(); textBlock.Margin = defaultMargin; textBlock.FontWeight = FontWeights.Bold; Binding text = new Binding("Name"); text.Source = formDropDown; text.Mode = BindingMode.OneWay; textBlock.SetBinding(TextBlock.TextProperty, text); ComboBox comboBox = new ComboBox(); comboBox.Margin = defaultMargin; Binding options = new Binding("Options"); options.Source = formDropDown; options.Mode = BindingMode.TwoWay; comboBox.SetBinding(ComboBox.ItemsSourceProperty, options); Binding selectedIndex = new Binding("SelectedIndex"); selectedIndex.Source = formDropDown; selectedIndex.Mode = BindingMode.TwoWay; comboBox.SetBinding(ComboBox.SelectedIndexProperty, selectedIndex); Binding selectedValue = new Binding("SelectedValue"); selectedValue.Source = formDropDown; selectedValue.Mode = BindingMode.OneWay; comboBox.SetBinding(ComboBox.SelectedValueProperty, selectedValue); Grid.SetColumn(textBlock, 0); Grid.SetColumn(comboBox, 1); grid.Children.Add(textBlock); grid.Children.Add(comboBox); uiList.Add(grid); } if (item is FormRadioButton) { FormRadioButton formRadioButton = item as FormRadioButton; StackPanel stackPanel = new StackPanel(); stackPanel.HorizontalAlignment = HorizontalAlignment.Stretch; stackPanel.VerticalAlignment = VerticalAlignment.Stretch; for (int i = 0; i < formRadioButton.Options.Count; i++) { TextBlock textBlock = new TextBlock(); textBlock.TextWrapping = TextWrapping.Wrap; textBlock.Text = formRadioButton.Options[i]; RadioButton radioButton = new RadioButton(); radioButton.Margin = defaultMargin; radioButton.Content = textBlock; radioButton.GroupName = item.Name; radioButton.Checked += (sender, args) => { formRadioButton.SelectedIndex = formRadioButton.Options.IndexOf(textBlock.Text); }; if (i == formRadioButton.SelectedIndex) { radioButton.IsChecked = true; } RowDefinition rowDefinition = new RowDefinition(); stackPanel.Children.Add(radioButton); } GroupBox groupBox = new GroupBox(); groupBox.Header = item.Name; groupBox.Content = stackPanel; groupBox.Margin = defaultMargin; uiList.Add(groupBox); } if (item is FormTextBox) { FormTextBox formTextBox = item as FormTextBox; Grid grid = new Grid(); ColumnDefinition columnDefinition1 = new ColumnDefinition(); columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star); ColumnDefinition columnDefinition2 = new ColumnDefinition(); columnDefinition2.Width = new GridLength(2.0, GridUnitType.Star); grid.ColumnDefinitions.Add(columnDefinition1); grid.ColumnDefinitions.Add(columnDefinition2); grid.HorizontalAlignment = HorizontalAlignment.Stretch; grid.VerticalAlignment = VerticalAlignment.Stretch; TextBlock textBlock = new TextBlock(); textBlock.FontWeight = FontWeights.Bold; textBlock.Margin = defaultMargin; Binding label = new Binding("Name"); label.Source = formTextBox; label.Mode = BindingMode.OneWay; textBlock.SetBinding(TextBlock.TextProperty, label); TextBox textBox = new TextBox(); textBox.Margin = defaultMargin; Binding text = new Binding("Text"); text.Source = formTextBox; text.Mode = BindingMode.TwoWay; text.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; textBox.SetBinding(TextBox.TextProperty, text); textBox.Text = item.Name; Grid.SetColumn(textBlock, 0); Grid.SetColumn(textBox, 1); grid.Children.Add(textBlock); grid.Children.Add(textBox); uiList.Add(grid); } if (item is FormTextBlock) { FormTextBlock formTextBlock = item as FormTextBlock; StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Vertical; stackPanel.HorizontalAlignment = HorizontalAlignment.Stretch; stackPanel.VerticalAlignment = VerticalAlignment.Stretch; stackPanel.Margin = defaultMargin; TextBlock textBlock = new TextBlock(); textBlock.FontWeight = FontWeights.Bold; textBlock.TextWrapping = TextWrapping.Wrap; Binding label = new Binding("Name"); label.Source = formTextBlock; label.Mode = BindingMode.OneWay; textBlock.SetBinding(TextBlock.TextProperty, label); TextBox textBox = new TextBox(); textBox.MinLines = 5; textBox.AcceptsReturn = true; textBox.AcceptsTab = true; textBox.TextWrapping = TextWrapping.Wrap; Binding text = new Binding("Text"); text.Source = formTextBlock; text.Mode = BindingMode.TwoWay; text.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; textBox.SetBinding(TextBox.TextProperty, text); textBox.Text = item.Name; stackPanel.Children.Add(textBlock); stackPanel.Children.Add(textBox); uiList.Add(stackPanel); } if (item is FormDate) { FormDate formDate = item as FormDate; Grid grid = new Grid(); ColumnDefinition columnDefinition1 = new ColumnDefinition(); columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star); ColumnDefinition columnDefinition2 = new ColumnDefinition(); columnDefinition2.Width = new GridLength(2.0, GridUnitType.Star); grid.ColumnDefinitions.Add(columnDefinition1); grid.ColumnDefinitions.Add(columnDefinition2); grid.HorizontalAlignment = HorizontalAlignment.Stretch; grid.VerticalAlignment = VerticalAlignment.Stretch; TextBlock textBlock = new TextBlock(); textBlock.FontWeight = FontWeights.Bold; textBlock.Margin = defaultMargin; textBlock.TextWrapping = TextWrapping.Wrap; Binding label = new Binding("Name"); label.Source = formDate; label.Mode = BindingMode.OneWay; textBlock.SetBinding(TextBlock.TextProperty, label); DatePicker datePicker = new DatePicker(); datePicker.Margin = defaultMargin; Binding date = new Binding("Date"); date.Source = formDate; date.Mode = BindingMode.TwoWay; date.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; datePicker.SetBinding(DatePicker.SelectedDateProperty, date); Grid.SetColumn(textBlock, 0); Grid.SetColumn(datePicker, 1); grid.Children.Add(textBlock); grid.Children.Add(datePicker); uiList.Add(grid); } } return(uiList); }