public XmlNode Save(UIElement control, XmlNode nd) { XmlDocument xd = nd.OwnerDocument; XmlElement el = xd.CreateElement(node); DataGrid dataGrid = (DataGrid)control; foreach (var item in dataGrid.Items) { if (item is Row1) { Row1 r = (Row1)item; el.SetAttribute(r.Name, r.Parameter); } } return(el); }
public UIElement GetEditor(XmlNode nd) { DataGrid dataGrid = new DataGrid() { CanUserReorderColumns = true, CanUserResizeColumns = true }; ObservableCollection <Row1> rows = new ObservableCollection <Row1>(); foreach (XmlAttribute attr in nd.Attributes) { Row1 r = new Row1() { Name = attr.Name, Parameter = attr.Value, }; rows.Add(r); } dataGrid.ItemsSource = rows; return(dataGrid); }