private void BindDataToUC() { gControls.Children.Clear(); double height = 0; int i = 0; List<Mapping> mappingData = new List<Mapping>(); Template selTemplate = (Template)cboTemplate.SelectedItem; if (selTemplate != null) { if (selTemplate.Columns != null) { foreach (string colName in selTemplate.Columns) { ucMapping m = new ucMapping(); mappingData = (XMLConvertHelper.GetMapping(selTemplate.TemplateName)); m.columnNames = InputColumns; m.LoadControlData(colName, mappingData, selTemplate.TemplateName); gControls.RowDefinitions.Add(new RowDefinition()); m.SetValue(Grid.RowProperty, i); gControls.Children.Add(m); i++; height += m.Height; } gControls.RowDefinitions.Add(new RowDefinition()); btnSave.SetValue(Grid.RowProperty, i); gControls.Children.Add(btnSave); mainStack.Height = height + 90; } } }
private Mapping CreateMappingData(ucMapping map) { Mapping mapping = new Mapping(); if (map != null) { mapping.inputColumns = new List<string>(); if (map.MC.SelectedItems != null) { foreach (KeyValuePair<string, object> s in map.MC.SelectedItems) { mapping.inputColumns.Add(s.Key); } } mapping.isUnique = (bool)map.chkUnique.IsChecked; mapping.format = !string.IsNullOrEmpty(map.txtSeparator.Text) ? map.txtSeparator.Text : " "; mapping.templatePropName = map.lblTemplateColumn.Content.ToString(); mapping.excludeValues = map.excludedList; mapping.replaceValues = map.replaceValues; mapping.inputFilenames = inputfiles.inputFilenames; mapping.OutputFolderPath = inputfiles.OutputFolderPath; mapping.templateFilenames = inputfiles.templateFilenames; mapping.TemplateFolder = inputfiles.TemplateFolder; mapping.ConfigFileName = this.cboTemplate.Text; } return mapping; }