public void LoadDataGrid() { try { DgLoadTable.Columns.Clear(); var columnNameXml = GetXmlColName(); for (var i = 0; i <= columnNameXml.Count - 1; i++) { var columnName = _classPropSld.ListColumnBinding().Where(x => x.PropertiesName == columnNameXml[i]).Select(y => y.Binding); var colName = new DataGridTextColumn { Header = columnNameXml[i], Binding = new Binding(columnName.Single()), Width = DataGridLength.Auto }; DgLoadTable.Columns.Add(colName); } DgLoadTable.ItemsSource = ClassPropertySldWorks.ListColumn(_swModel); //((DataGridTextColumn)DgLoadTable.Columns[0]).Binding = new Binding("."); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void InsertTable() { try { //DeleteTable(); var sldPropName = _classPropSld.ListColumnBinding(); var columnNameXml = GetXmlColName(); var myTable = _swDraw.InsertTableAnnotation(-0, 0, 1, ClassPropertySldWorks.ListColumn(_swModel).Count() + 1, GetXmlColName().Count); if ((myTable == null)) { return; } myTable.BorderLineWeight = 2; myTable.GridLineWeight = 1; for (var i = 0; i <= columnNameXml.Count - 1; i++) { var column = sldPropName.Where(x => x.PropertiesName == columnNameXml[i]).Select(y => y.PropertiesName); myTable.Text[0, i] = column.Single(); myTable.SetColumnWidth(i, 0.05, 0); for (var row = 0; row < DgLoadTable.Items.Count; row++) { var b = DgLoadTable.Columns[i].GetCellContent(DgLoadTable.Items[row]) as TextBlock; myTable.Text[row + 1, i] = b.Text; //if (row > 1) //{ // myTable.set_CellTextHorizontalJustification(row, 0, (int)swTextJustification_e.swTextJustificationRight); //} } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void LoadDataGrid() { DataGridTable.ItemsSource = ClassPropertySldWorks.ListColumnToEditProp(_swModel); }