Exemple #1
0
 private void EncodeNodes(TreeViewItemCollection NColl, XmlElement myXML, XmlDataDocument myXMLobj)
 {
     foreach (TreeViewItem Itm in NColl)
     {
         XmlElement nx = myXMLobj.CreateElement("item");
         nx.SetAttribute("Text", Itm.Text);
         nx.SetAttribute("Image", Itm.Image);
         nx.SetAttribute("Link", Itm.Link);
         nx.SetAttribute("TargetFrame", Itm.TargetFrame);
         nx.SetAttribute("Open", Itm.Open.ToString());
         nx.SetAttribute("value", Itm.Value);
         nx.SetAttribute("Selector", Itm.Selector.ToString());
         nx.SetAttribute("Selected", Itm.Selected.ToString());
         nx.SetAttribute("OnClick", Itm.OnClick);
         nx.SetAttribute("LoadOnExpand", Itm.LoadOnExpand.ToString());
         myXML.AppendChild(nx);
         if (Itm.Items.Count > 0)
         {
             EncodeNodes(Itm.Items, nx, myXMLobj);
         }
     }
 }
Exemple #2
0
        private void DecodeItems(ref TreeViewItemCollection NColl, XmlElement myXML)
        {
            foreach (XmlElement Node in myXML.ChildNodes)
            {
                TreeViewItem tvi = NColl.Add();

                tvi.Text         = Node.GetAttribute("Text");
                tvi.Image        = Node.GetAttribute("Image");
                tvi.Link         = Node.GetAttribute("Link");
                tvi.TargetFrame  = Node.GetAttribute("TargetFrame");
                tvi.Open         = Convert.ToBoolean(Node.GetAttribute("Open"));
                tvi.Selector     = (TreeViewItem.SelectionMode)Enum.Parse(typeof(TreeViewItem.SelectionMode), Node.GetAttribute("Selector"));
                tvi.Selected     = Convert.ToBoolean(Node.GetAttribute("Selected"));
                tvi.Value        = Node.GetAttribute("value");
                tvi.OnClick      = Node.GetAttribute("OnClick");
                tvi.LoadOnExpand = Convert.ToBoolean(Node.GetAttribute("LoadOnExpand"));

                if (Node.ChildNodes.Count > 0)
                {
                    DecodeItems(ref NColl, Node);
                }
            }
        }
Exemple #3
0
 private void EncodeNodes(TreeViewItemCollection NColl, XmlElement myXML, XmlDataDocument myXMLobj)
 {
     foreach (TreeViewItem Itm in NColl)
      {
     XmlElement nx = myXMLobj.CreateElement("item");
     nx.SetAttribute("Text", Itm.Text);
     nx.SetAttribute("Image", Itm.Image);
     nx.SetAttribute("Link", Itm.Link);
     nx.SetAttribute("TargetFrame", Itm.TargetFrame);
     nx.SetAttribute("Open", Itm.Open.ToString());
     nx.SetAttribute("value", Itm.Value);
     nx.SetAttribute("Selector", Itm.Selector.ToString());
     nx.SetAttribute("Selected", Itm.Selected.ToString());
     nx.SetAttribute("OnClick", Itm.OnClick);
     nx.SetAttribute("LoadOnExpand", Itm.LoadOnExpand.ToString());
     myXML.AppendChild(nx);
     if (Itm.Items.Count > 0)
     {
        EncodeNodes(Itm.Items, nx, myXMLobj);
     }
      }
 }
Exemple #4
0
        private void DecodeItems(ref TreeViewItemCollection NColl, XmlElement myXML)
        {
            foreach (XmlElement Node in myXML.ChildNodes)
             {
            TreeViewItem tvi = NColl.Add();

            tvi.Text = Node.GetAttribute("Text");
            tvi.Image = Node.GetAttribute("Image");
            tvi.Link = Node.GetAttribute("Link");
            tvi.TargetFrame = Node.GetAttribute("TargetFrame");
            tvi.Open = Convert.ToBoolean(Node.GetAttribute("Open"));
            tvi.Selector = (TreeViewItem.SelectionMode) Enum.Parse( typeof(TreeViewItem.SelectionMode), Node.GetAttribute("Selector") );
            tvi.Selected = Convert.ToBoolean(Node.GetAttribute("Selected"));
            tvi.Value = Node.GetAttribute("value");
            tvi.OnClick = Node.GetAttribute("OnClick");
            tvi.LoadOnExpand = Convert.ToBoolean(Node.GetAttribute("LoadOnExpand"));

            if (Node.ChildNodes.Count > 0)
            {
               DecodeItems(ref NColl, Node);
            }
             }
        }