本文整理汇总了C#中Tree.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.DataBind方法的具体用法?C# Tree.DataBind怎么用?C# Tree.DataBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.DataBind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindLeftAccordion
private void BindLeftAccordion()
{
XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();
XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Tree/TreeNode");
foreach (XmlNode xmlNode in xmlNodes)
{
if (xmlNode.HasChildNodes)
{
AccordionPane accordionPane = new AccordionPane();
accordionPane.Title = xmlNode.Attributes["Text"].Value;
accordionPane.Layout = Layout.Fit;
accordionPane.ShowBorder = false;
accordionPane.BodyPadding = "2px 0 0 0";
leftAccordion.Items.Add(accordionPane);
Tree innerTree = new Tree();
innerTree.EnableArrows = true;
innerTree.ShowBorder = false;
innerTree.ShowHeader = false;
innerTree.EnableIcons = false;
innerTree.AutoScroll = true;
accordionPane.Items.Add(innerTree);
XmlDocument innerXmlDoc = new XmlDocument();
innerXmlDoc.LoadXml(String.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Tree>{0}</Tree>", xmlNode.InnerXml));
// 绑定AccordionPane内部的树控件
innerTree.DataSource = innerXmlDoc;
innerTree.DataBind();
}
}
}
示例2: InitTreeMenu
private Tree InitTreeMenu()
{
Tree treeMenu = new Tree();
treeMenu.ID = "treeMenu";
treeMenu.EnableArrows = true;
treeMenu.ShowBorder = false;
treeMenu.ShowHeader = false;
treeMenu.EnableIcons = false;
treeMenu.AutoScroll = true;
Region2.Items.Add(treeMenu);
// 绑定 XML 数据源到树控件
treeMenu.DataSource = XmlDataSource1;
treeMenu.DataBind();
// 重新设置每个节点的图标
ResolveTreeNode(treeMenu.Nodes);
return treeMenu;
}
示例3: InitAccordionMenu
private Accordion InitAccordionMenu()
{
Accordion accordionMenu = new Accordion();
accordionMenu.ID = "accordionMenu";
accordionMenu.EnableFill = true;
accordionMenu.ShowBorder = false;
accordionMenu.ShowHeader = false;
leftRegion.Items.Add(accordionMenu);
XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();
XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Tree/TreeNode");
foreach (XmlNode xmlNode in xmlNodes)
{
if (xmlNode.HasChildNodes)
{
AccordionPane accordionPane = new AccordionPane();
accordionPane.Title = xmlNode.Attributes["Text"].Value;
accordionPane.Layout = Layout.Fit;
accordionPane.ShowBorder = false;
accordionPane.BodyPadding = "2px 0 0 0";
accordionMenu.Items.Add(accordionPane);
Tree innerTree = new Tree();
innerTree.EnableArrows = true;
innerTree.ShowBorder = false;
innerTree.ShowHeader = false;
innerTree.EnableIcons = false;
innerTree.AutoScroll = true;
innerTree.EnableSingleClickExpand = true;
accordionPane.Items.Add(innerTree);
XmlDocument innerXmlDoc = new XmlDocument();
innerXmlDoc.LoadXml(String.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Tree>{0}</Tree>", xmlNode.InnerXml));
// 绑定AccordionPane内部的树控件
innerTree.DataSource = innerXmlDoc;
innerTree.DataBind();
// 重新设置每个节点的图标
ResolveTreeNode(innerTree.Nodes);
}
}
return accordionMenu;
}