Abstract: This article is primarily about filefolderdialog in WPF, complementing the related properties (Data binding) and command bindings (Delegate) for popup child windows in the parent window , as well as child windows. Command), there is also a way to read and write XML file content.
Places to be aware of:
(1) For each window (parent window and child window), if it involves the Data Binding related problems, it is necessary to set their corresponding DataContext(generally for its ViewModel);
(2) For a property that is not initialized in the constructor, it needs to be instantiated at the time of definition (as follows:), otherwise the Property object will not be available;
Private Condition _queryconditions=New Condition (); // It is important to create an instance object here Public Condition queryconditions{ getreturn _queryconditions;} Set { = value; this. raisePropertyChanged ("queryconditions");} }
(3) The relative path is used as follows:
Private voidAddpacsnode () {XmlDocument xmldoc=NewXmlDocument (); Xmldoc.load (@".. \.. \data\pacsconfig.xml");//relative Path//xmldoc.load (@ "C:\Users\Administrator\Documents\Visual Studio 2015\projects\day5\testopenfiledialog\ Testopenfiledialog\data\pacsconfig.xml "); //Absolute PathXmlNode root = Xmldoc.selectsinglenode ("PACS");//Find <PACS>XmlElement xe1 = xmldoc.createelement ("Pacsnode");//Create a <PacsNode> nodeXmlElement xesub1 = xmldoc.createelement ("Aetitle"); Xesub1. InnerText= Tempdataview.aetitle;//Set the text nodeXe1. AppendChild (XESUB1);//Add to <book> nodeXmlElement xesub2 = xmldoc.createelement ("HostIP"); Xesub2. InnerText=Tempdataview.hostip; Xe1. AppendChild (XESUB2); XmlElement xesub3= Xmldoc.createelement ("Port"); Xesub3. InnerText=Tempdataview.port; Xe1. AppendChild (XESUB3); XmlElement XESUB4= Xmldoc.createelement ("HostName"); Xesub4. InnerText=Tempdataview.hostname; Xe1. AppendChild (XESUB4); Root. AppendChild (XE1); //Add to <bookstore> nodeXmldoc.save (@".. \.. \data\pacsconfig.xml");//relative Path This. LoadData (); }
Related Code address: Http://pan.baidu.com/s/1bpwuJi3
Some issues with WPF Filefolderdialog and popup child windows