我使用TileLayoutControl。我使用WriteToXML()和ReadFromXML()来保存和还原项目位置(这些项目为Tile)。我也将能够在XML文件中保存项目“可见性”,以在是否可见Tile的情况下进行恢复。我该怎么做?
谢谢回复。
答案 0 :(得分:0)
如果您需要保存/加载自定义属性,请处理LayoutControl.WriteElementToXML和LayoutControl.ReadElementFromXML事件:
using DevExpress.Xpf.LayoutControl;
using DevExpress.Xpf.Core.Native;
void tileLayoutControl1_WriteElementToXML(object sender, LayoutControlWriteElementToXMLEventArgs e) {
if (typeof(Tile).IsAssignableFrom(e.Element.GetType()))
e.Element.WritePropertyToXML(e.Xml, UIElement.VisibilityProperty, "Visibility");
}
void tileLayoutControl1_ReadElementFromXML(object sender, LayoutControlReadElementFromXMLEventArgs e) {
if (typeof(Tile).IsAssignableFrom(e.Element.GetType()))
e.Element.ReadPropertyFromXML(e.Xml, UIElement.VisibilityProperty, "Visibility", typeof(Visibility));
}