
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < UserControl x:Class ="TreevIEwDemo.MainPage"
2 xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:d ="http://schemas.microsoft.com/Expression/blend/2008"
5 xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:sys ="clr-namespace:System;assembly=mscorlib"
7 mc:Ignorable ="d" d:DesignWIDth ="640" d:DesignHeight ="480" >
8 < GrID x:name ="LayoutRoot" >
9 < ListBox >
10 < sys:String > 树型演示1 </ sys:String >
11 < sys:String > 树型演示2 </ sys:String >
12 < sys:String > 树型演示3 </ sys:String >
13 < sys:String > 树型演示4 </ sys:String >
14 < sys:String > 树型演示5 </ sys:String >
15 </ ListBox >
16 </ GrID >
17 </ UserControl > 运行后会显示: 在上面代码基础上,我们可以添加一个ItemTemplate,对数据进行绑定。 <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < UserControl x:Class ="TreevIEwDemo.MainPage"
2 xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:d ="http://schemas.microsoft.com/Expression/blend/2008"
5 xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:sys ="clr-namespace:System;assembly=mscorlib"
7 mc:Ignorable ="d" d:DesignWIDth ="640" d:DesignHeight ="480" >
8 < GrID x:name ="LayoutRoot" >
9 < ListBox >
10 < ListBox.ItemTemplate >
11 < DataTemplate >
12 < TextBlock Foreground ="Blue" Text =" {Binding} " />
13 </ DataTemplate >
14 </ ListBox.ItemTemplate >
15 < sys:String > 树型演示1 </ sys:String >
16 < sys:String > 树型演示2 </ sys:String >
17 < sys:String > 树型演示3 </ sys:String >
18 < sys:String > 树型演示4 </ sys:String >
19 < sys:String > 树型演示5 </ sys:String >
20 </ ListBox >
21 </ GrID >
22 </ UserControl >
23 运行结果如下: 这里ListBox的选项都变成了蓝色。 就像我们前面所说的,ListBox是一个ItemsControl,任何ItemsControl都是相同的,可以将它们的内容包括到一个容器中。所以,我们可以再次重写上面代码: <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < UserControl x:Class ="TreevIEwDemo.MainPage"
2 xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:d ="http://schemas.microsoft.com/Expression/blend/2008"
5 xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:sys ="clr-namespace:System;assembly=mscorlib"
7 mc:Ignorable ="d" d:DesignWIDth ="640" d:DesignHeight ="480" >
8 < GrID x:name ="LayoutRoot" >
9 < ListBox >
10
11
12 < ListBoxItem Content ="树型演示1" >
13 < ListBoxItem.ContentTemplate >
14 < DataTemplate x:name ="myTemplate" >
15 < TextBlock Foreground ="Blue" Text =" {Binding} " />
16 </ DataTemplate >
17 </ ListBoxItem.ContentTemplate >
18 </ ListBoxItem >
19 < ListBoxItem Content ="树型演示2" ContentTemplate =" {Binding Elementname=myTemplate} " />
20 < ListBoxItem Content ="树型演示3" ContentTemplate =" {Binding Elementname=myTemplate} " />
21 < ListBoxItem Content ="树型演示4" ContentTemplate =" {Binding Elementname=myTemplate} " />
22 < ListBoxItem Content ="树型演示5" ContentTemplate =" {Binding Elementname=myTemplate} " />
23 </ ListBox >
24 </ GrID >
25 </ UserControl >
26 在上面的代码中,ListBox中创建五个ListBoxItem,ListBoxItem的Content属性绑定着不同的选项,而ListBoxItem的ContentTemplate绑定着ListBox的ItemTemplate。 运行结果和上面的相同: 根据上面的基础,我们可以使用同样的概念来理解Silverlight Treeivew控件。 在使用TreevIEw控件前,需要添加引用,TreevIEw控件被装配在System.windows.Controls下,另外在客户端页面需要添加命名空间如下: <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> xmlns:Controls="clr-namespace:System.windows.Controls;assembly=System.windows.Controls" TreevIEw控件也是一个ItemsControl,同样,每次初始化,TreevIEw控件会为所属选项创建TreeVIEwItem。 如果我们使用和ListBox同样的代码,可以得到下面结果, <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < UserControl x:Class ="TreevIEwDemo.MainPage"
2 xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:d ="http://schemas.microsoft.com/Expression/blend/2008"
5 xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:sys ="clr-namespace:System;assembly=mscorlib"
7 xmlns:Controls ="clr-namespace:System.windows.Controls;assembly=System.windows.Controls"
8 mc:Ignorable ="d" d:DesignWIDth ="640" d:DesignHeight ="480" >
9 < GrID x:name ="LayoutRoot" >
10 < Controls:TreeVIEw >
11 < sys:String > 树形演示1 </ sys:String >
12 < sys:String > 树形演示2 </ sys:String >
13 < sys:String > 树形演示3 </ sys:String >
14 </ Controls:TreeVIEw >
15 </ GrID >
16 </ UserControl >
17 运行结果: 同样,也可以添加ItemTemplate到TreevIEw控件, <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < UserControl x:Class ="TreevIEwDemo.MainPage"
2 xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:d ="http://schemas.microsoft.com/Expression/blend/2008"
5 xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:sys ="clr-namespace:System;assembly=mscorlib"
7 xmlns:Controls ="clr-namespace:System.windows.Controls;assembly=System.windows.Controls"
8 mc:Ignorable ="d" d:DesignWIDth ="640" d:DesignHeight ="480" >
9 < GrID x:name ="LayoutRoot" >
10 < Controls:TreeVIEw >
11 < Controls:TreeVIEw.ItemTemplate >
12 < DataTemplate >
13 < TextBlock Foreground ="Green" Text =" {Binding} " />
14 </ DataTemplate >
15 </ Controls:TreeVIEw.ItemTemplate >
16 < sys:String > 树型演示1 </ sys:String >
17 < sys:String > 树型演示2 </ sys:String >
18 < sys:String > 树型演示3 </ sys:String >
19 </ Controls:TreeVIEw >
20 </ GrID >
21 </ UserControl >
22 运行结果: 从上面,我们可以看出,ListBox和TreevIEw有很多相似之处,在一些情况下基本可以替换使用,但是,这两个控件也有明显的区别。TreeVIEw控件在建立选项的时候,使用的是 TreeViewItem类,而TreeVIEwItem是headeredItemsControl(详细定义可以查看MSDN http://msdn.microsoft.com/en-us/library/system.windows.controls.treeviewitem(VS.95).aspx),作为headeredItemsControl,可以将控件选项内容赋值到header或者headerTemplate属性中。 这里,我们可以简单的理解,headeredItemsControl的header/headerTemplate和ContentControl的Content/ContentTemplate功能是相同的,都是呈现内容的载体。 所以,在ListBox中,选项是被绑定到ListBoxItem的content属性中,而在TreevIEw控件中,选项是被绑定到TreeVIEwItem的header属性中。同样,TreeVIEw的ItemTemplate绑定也可以使用TreevIEwItem的headerTemplate属性进行绑定,结果是相同的。根据上面所述,可以得到下面的代码: <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < UserControl x:Class ="TreevIEwDemo.MainPage"
2 xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:d ="http://schemas.microsoft.com/Expression/blend/2008"
5 xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:sys ="clr-namespace:System;assembly=mscorlib"
7 xmlns:Controls ="clr-namespace:System.windows.Controls;assembly=System.windows.Controls"
8 mc:Ignorable ="d" d:DesignWIDth ="640" d:DesignHeight ="480" >
9 < GrID x:name ="LayoutRoot" >
10 < Controls:TreeVIEw >
11 < Controls:TreeVIEwItem header ="树型演示1" >
12 < Controls:TreeVIEwItem.headerTemplate >
13 < DataTemplate x:name ="myTemplate" >
14 < TextBlock Foreground ="Green" Text =" {Binding} " />
15 </ DataTemplate >
16 </ Controls:TreeVIEwItem.headerTemplate >
17 </ Controls:TreeVIEwItem >
18 < Controls:TreeVIEwItem header ="树型演示2" headerTemplate =" {Binding Elementname=myTemplate} " />
19 < Controls:TreeVIEwItem header ="树型演示3" headerTemplate =" {Binding Elementname=myTemplate} " />
20 </ Controls:TreeVIEw >
21 </ GrID >
22 </ UserControl >
23 运行结果和上面相同: 相信通过上面的演示,大家已经基本理解ItemsControl的Template使用,根据上述,我们可以延伸到HIErarchicalDataTemplate,使用HIErarchicalDataTemplate我们需要建立一个例程数据类供TreeVIEw调用。 <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 public class Country
2 {
3 public Country()
4 {
5 Privinces = new ObservableCollection < Province > ();
6 }
7
8 public string name { get ; set ; }
9 public ObservableCollection < Province > Privinces { get ; set ; }
10 }
11
12 public class Province
13 {
14 public Province()
15 {
16 Citys = new ObservableCollection < City > ();
17 }
18
19 public string name { get ; set ; }
20 public ObservableCollection < City > Citys { get ; set ; }
21 }
22
23 public class City
24 {
25 public string name { get ; set ; }
26 } 然后建立例程数据,代码如下: 代码 <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 tvDemo.ItemsSource = new ObservableCollection < Country > {
2 new Country {
3 name = " 中国 " ,
4 Privinces = { new Province
5 {
6 name = " 山东省 " ,
7 Citys = {
8 new City { name = " 济南市 " },
9 new City { name = " 淄博市 " }
10 }
11 },
12 new Province
13 {
14 name = " 广东省 " ,
15 Citys = {
16 new City { name = " 广州市 " },
17 new City { name = " 佛山市 " }
18 }
19 }
20 }
21 },
22 new Country {
23 name = " 加拿大 " ,
24 Privinces = { new Province
25 {
26 name = " 哥伦比亚省 " ,
27 Citys = {
28 new City { name = " 温哥华市 " },
29 new City { name = " 维多利亚市 " }
30 }
31 },
32 new Province
33 {
34 name = " 阿尔伯塔省 " ,
35 Citys = {
36 new City { name = " 埃德蒙顿市 " },
37 new City { name = " 卡尔加里市 " }
38 }
39 }
40 }
41 }
42 }; 首先我们使用TreeVIEw的ItemTemplate来显示该数据树形结构,前台代码: <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < Controls:TreeVIEw x:name ="tvDemo" >
2 < Controls:TreeVIEw.ItemTemplate >
3 < DataTemplate >
4 < TextBlock Text =" {Binding name} " />
5 </ DataTemplate >
6 </ Controls:TreeVIEw.ItemTemplate >
7 </ Controls:TreeVIEw > 显示结果如下: 这里TreevIEw控件建立了两个TreeVIEwItems,并且绑定TreeVIEwitem的header属性到Country对象,而且将TreeVIEwItem的headerTemplate设置为TreeVIEw的ItemTemplate。下面,我们需要子数据同时绑定到TreevIEw控件中,这里我们需要使用HIErarchicalDataTemplate。在使用HIErarchicalDataTemplate前,需要声明新的命名空间: <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> xmlns:common="clr-namespace:System.windows;assembly=System.windows.Controls"
其实HIErarchicalDataTemplate是一个带有多个扩展属性DataTemplate。 如果我们不使用这些扩展属性,HIErarchicalDataTemplate和普通DataTemplate是相同的,例如,我们修改上面代码: <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < Controls:TreeVIEw x:name ="tvDemo" >
2 < Controls:TreeVIEw.ItemTemplate >
3 < common:HIErarchicalDataTemplate >
4 < TextBlock Text =" {Binding name} " />
5 </ common:HIErarchicalDataTemplate >
6 </ Controls:TreeVIEw.ItemTemplate >
7 </ Controls:TreeVIEw >
8 显示结果和上面相同: 所谓HIErarchicalDataTemplate的扩展属性,主要是ItemsSource和ItemTemplate两个属性。其中ItemsSource属性可以获取TreeVIEw.ItemsSource的数据,ItemTemplate可以获取到TreeVIEwItem.ItemTemplate模板。根据这两个属性,我们可以修改以上代码,获取到子数据。通常来说,我们会把HIErarchicalDataTemplate定义在Resource中,这样可以使代码布局整洁,另外提高易读性。 <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> 1 < UserControl.Resources >
2 < common:HIErarchicalDataTemplate x:Key ="CityTemplate" >
3 < StackPanel >
4 < TextBlock Text =" {Binding name} " />
5 </ StackPanel >
6 </ common:HIErarchicalDataTemplate >
7 < common:HIErarchicalDataTemplate x:Key ="ProvinceTemplate" ItemsSource =" {Binding Citys} " ItemTemplate =" {StaticResource CityTemplate} " >
8 < StackPanel >
9 < TextBlock Text =" {Binding name} " Foreground ="Green" />
10 </ StackPanel >
11 </ common:HIErarchicalDataTemplate >
12 < common:HIErarchicalDataTemplate x:Key ="CountryTemplate" ItemsSource =" {Binding Privinces} " ItemTemplate =" {StaticResource ProvinceTemplate} " >
13 < TextBlock Text =" {Binding name} " Foreground ="Blue" />
14 </ common:HIErarchicalDataTemplate >
15 </ UserControl.Resources > 在Resource中设置完HIErarchicalDataTemplate,在TreeVIEw控件中调用ItemTemplate就可以了。 <!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> < Controls:TreeVIEw x:name ="tvDemo" ItemTemplate =" {StaticResource CountryTemplate} " ></ Controls:TreeVIEw > 显示结果如下: 值得注意的是,在定义资源文件的时候,设置 CityTemplate, ProvinceTemplate和CountryTemplate的顺序不能交换,否则无法查找到相关资源模板,同时,该资源文件也需要放在TreeVIEw控件声明前,否则也是无法找到相关资源模板。 感谢 银光中国网 ( SilverlightChina.Net) 提供空间发布代码和演示。 在线演示: http://silverlightchina.net/html/tips/2009/1211/391.html 源码下载: http://silverlightchina.net/uploads/soft/091211/1-091211164055.zip
本文出自 “专注Silverlight” 博客,请务必保留此出处http://www.voidcn.com/article/p-zdjhikjl-bke.html
左面的树采用的是用户控件中的TreeVIEw,数据绑定完成后,在主页面还需要给此用户控件中的TreeVIEw添加事件,来更新右面的面板
Xaml代码:
被演示出来。因为在我们平时开发过程中,数据是被动态查询获取的(不是DEMO中的静态文件方式)。
因此今天就演示一下如何使用WCF来获取相应数据并使用TreeVIEw来动态加载相应结点信息。
首先,我们要创建一个WCF服务来获取相应的树形节点数据信息,如下:
public class ForumInfo
{
public int ForumID { get ; set ; }
public int ParendID { get ; set ; }
public string Forumname { get ; set ; }
}
[ServiceContract(namespace = "" )]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class DateService
{
[OperationContract]
public List < ForumInfo > GetForumData()
{
List < ForumInfo > forumList = new List < ForumInfo > ();
forumList.Add( new ForumInfo() { ForumID = 1 , ParendID = 0 , Forumname = " 笔记本版块 " });
forumList.Add( new ForumInfo() { ForumID = 2 , Forumname = " 台式机版块 " });
forumList.Add( new ForumInfo() { ForumID = 3 , ParendID = 1 , Forumname = " Dell笔记本 " });
forumList.Add( new ForumInfo() { ForumID = 4 , Forumname = " IBM笔记本 " });
forumList.Add( new ForumInfo() { ForumID = 5 , ParendID = 4 , Forumname = " IBM-T系列 " });
forumList.Add( new ForumInfo() { ForumID = 6 , Forumname = " IBM-R系列 " });
forumList.Add( new ForumInfo() { ForumID = 7 , ParendID = 2 , Forumname = " 联想台式机 " });
forumList.Add( new ForumInfo() { ForumID = 8 , Forumname = " 方正台式机 " });
forumList.Add( new ForumInfo() { ForumID = 9 , Forumname = " HP台式机 " });
forumList.Add( new ForumInfo() { ForumID = 10 , ParendID = 7 , Forumname = " 联想家悦H系列 " });
forumList.Add( new ForumInfo() { ForumID = 11 , Forumname = " 联想IDeaCentre系列 " });
return forumList;
}
} 复制代码
从代码中可看出,ForumInfo是使用ParendID来记录父结点信息并以此来创建一个树形结构的,而方法:
GetForumData()即是演示了我们平时查询数据的过程。我们在Silverlight中添加对该服务的引用即可。
我们在Silverlight中添加对Silverlight Toolkit相关DLL引用,然后向XAML文件上拖入一个TREEVIEW
控件。并将其命名为“TreeOflife”,最后我们再放几个TextBlock来显示树形结点被点击后显示的相应的
ForumInfo信息。最后XAML中的内容如下所示:
< controls:TreeVIEw x:name ="TreeOflife" margin ="5" GrID.Column ="0" GrID.Row ="1"
selecteditemchanged ="TreeOflife_selecteditemchanged" />
< border borderBrush ="Gray" borderThickness ="1" padding ="8" margin ="8,0" GrID.Row ="1" GrID.Column ="1" >
< StackPanel x:name ="DetailsPanel" margin ="4" >
< StackPanel OrIEntation ="Horizontal" >
< TextBlock Text ="版块ID: " FontWeight ="Bold" />
< TextBlock Text =" {Binding ForumID} " />
</ StackPanel >
< StackPanel OrIEntation ="Horizontal" >
< TextBlock Text ="版块名称: " FontWeight ="Bold" />
< TextBlock Text =" {Binding Forumname} " />
</ StackPanel >
< StackPanel OrIEntation ="Horizontal" >
< TextBlock Text ="版块信息: " FontWeight ="Bold" />
< TextBlock x:name ="DetailText" textwrapPing ="Wrap" Text =" {Binding Forumname} " />
</ StackPanel >
</ StackPanel >
</ border > 复制代码
下面是相应的XAML.CS文件中的内容,主要是使用递归方式遍历数据列表并创建相关的结点信息:
public partial class Page : UserControl
{
DateServiceClIEnt dataServiceClIEnt = new DateServiceClIEnt();
ObservableCollection < ForumInfo > forumList = new ObservableCollection < ForumInfo > ();
public Page()
{
InitializeComponent();
// 此样式只添加在根结点上
// TreeOflife.ItemContainerStyle = this.Resources["RedItemStyle"] as Style;
dataServiceClIEnt.GetForumDataCompleted += new EventHandler < GetForumDataCompletedEventArgs > (dataServiceClIEnt_GetForumDataCompleted);
dataServiceClIEnt.GetForumDataAsync();
}
voID dataServiceClIEnt_GetForumDataCompleted( object sender, GetForumDataCompletedEventArgs e)
{
try
{
forumList = e.Result;
AddTreeNode( 0 , null );
}
catch
{
throw new NotImplementedException();
}
}
private voID AddTreeNode( int parentID, TreeVIEwItem treeVIEwItem)
{
List < ForumInfo > result = (from forumInfo in forumList
where forumInfo.ParendID == parentID
select forumInfo).ToList < ForumInfo > ();
if (result.Count > 0 )
{
foreach (ForumInfo foruminfo in result)
{
TreeVIEwItem objTreeNode = new TreeVIEwItem();
objTreeNode.header = foruminfo.Forumname;
objTreeNode.DataContext = foruminfo;
// 此样式将会添加的所有叶子结点上
// objTreeNode.ItemContainerStyle = this.Resources["RedItemStyle"] as Style;
// 添加根节点
if (treeVIEwItem == null )
{
TreeOflife.Items.Add(objTreeNode);
}
else
{
treeVIEwItem.Items.Add(objTreeNode);
}
AddTreeNode(foruminfo.ForumID, objTreeNode);
}
}
}
private voID TreeOflife_selecteditemchanged( object sender, RoutedPropertyChangedEventArgs < object > e)
{
TreeVIEwItem item = e.NewValue as TreeVIEwItem;
ForumInfo fi = item.DataContext as ForumInfo;
DetailsPanel.DataContext = fi;
}
} 复制代码
下面演示一下效果,如下图所示:
当前TreeVIEw控件还支持样式定义,比如可以给每个树形结点前添加CheckBox和一个小图标,这里我们使用下
面样式:
< UserControl.Resources >
< Style x:Key ="RedItemStyle" targettype ="controls:TreeVIEwItem" >
< Setter Property ="headerTemplate" >
< Setter.Value >
< DataTemplate >
< StackPanel OrIEntation ="Horizontal" >
< CheckBox />
< Image Source ="image/default.png" />
< TextBlock Text =" {Binding} " Foreground ="Red" FontStyle ="Italic" />
</ StackPanel >
</ DataTemplate >
</ Setter.Value >
</ Setter >
< Setter Property ="IsExpanded" Value ="True" />
</ Style >
</ UserControl.Resources > 复制代码
然后在cs文件中使用下面语句将该样式绑定到TreeVIEw上:
TreeOflife.ItemContainerStyle = this .Resources[ " RedItemStyle " ] as Style;
下面就是应用了该样式的运行效果:
当前TreeVIEw中定义样式模版还可以使用ItemTemplate,下面是一段样式代码:
< controls:HIErarchicalDataTemplate ItemsSource =" {Binding Subclasses} "
ItemContainerStyle =" {StaticResource ExpandedItemStyle} " >
< StackPanel >
< TextBlock Text =" {Binding Rank} " FontSize ="8" FontStyle ="Italic" Foreground ="Gray" margin ="0 0 0 -5" />
< TextBlock Text =" {Binding Classification} " />
</ StackPanel >
</ controls:HIErarchicalDataTemplate >
</ controls:TreeVIEw.ItemTemplate > 复制代码
运行该样式的效果如下图所示:
好了,今天的内容就先到这里了。
DEMO下载,请 点击这里:)
原文链接: http://www.cnblogs.com/daizhj/archive/2009/01/08/1372088.html 作者: daizhj,代震军 Tags: silverlight,treevIEw,树形,控件 网址: http://daizhj.cnblogs.com/ 总结
以上是内存溢出为你收集整理的详解Silverlight Treeview的HierarchicalDataTemplate使用全部内容,希望文章能够帮你解决详解Silverlight Treeview的HierarchicalDataTemplate使用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)