稳扎稳打Silverlight(36) - 3.0控件之TreeView,List
Box增强,DataGrid增强,MediaElement增强
<
@H_
618_77@navigation:Page
x:Class
="Silverlight30.Control.TreeView"
xmlns:controls
="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:common
="clr-namespace:System.Windows;assembly=System.Windows.Controls"
xmlns
="http://scheR_121_11845@as.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://scheR_121_11845@as.microsoft.com/winfx/2006/xaml"
xmlns:d
="http://scheR_121_11845@as.microsoft.com/expression/blend/2008"
xmlns:mc
="http://scheR_121_11845@as.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable
="d"
xmlns:navigation
="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth
="640"
d:DesignHeight
="480"
title
="TreeView Page"
>
<
@H_
618_77@Grid
x:Name
="LayoutRoot"
>
<
@H_
618_77@StackPanel
>
<
@H_
618_77@StackPane
l.resources
>
<!--
HierarchicalDataTemplate - 呈现层级数据的数据模板
Itemssource - 指定下一级数据的数据源
ItemTemplate - 指定下一级数据的数据模板
-->
<
@H_
618_77@common:HierarchicalDataTemplate
x:Key
="childTemplate"
Itemssource
="
{Binding Path=Children}
"
>
<
@H_
618_77@StackPanel
Orientation
="Horizontal"
>
<
@H_
618_77@
check
Box
/>
<
@H_
618_77@TextBlock
Text
="
{Binding Path=titlE}
"
FontStyle
="Italic"
/>
</
@H_
618_77@StackPanel
>
</
@H_
618_77@common:HierarchicalDataTemplate
>
<
@H_
618_77@common:HierarchicalDataTemplate
x:Key
="treeTemplate"
Itemssource
="
{Binding Path=Children}
"
ItemTemplate
="
{Staticresource childTemplatE}
"
>
<
@H_
618_77@TextBlock
Text
="
{Binding Path=titlE}
"
FontWeight
="Bold"
/>
</
@H_
618_77@common:HierarchicalDataTemplate
>
</
@H_
618_77@StackPane
l.resources
>
<!--
Itemssource - 数据源
ItemTemplate - 指定层级显示数据的模板
-->
<
@H_
618_77@controls:TreeView
x:Name
="treeView"
Margin
="5"
Itemssource
="
{Binding}
"
ItemTemplate
="
{Staticresource treeTemplatE}
"
SELEctedItemChanged
="treeView_SELEctedItemChanged"
>
</
@H_
618_77@controls:TreeView
>
<!--
TreeViewItem - TreeView 的项
Header - 项的标题
HeaderTemplate - 项的标题模板
-->
<
@H_
618_77@controls:TreeView
x:Name
="treeView2"
Margin
="5"
>
<
@H_
618_77@controls:TreeViewItem
Header
="level 1"
>
<
@H_
618_77@controls:TreeViewItem
Header
="level 2"
>
<
@H_
618_77@controls:TreeViewItem
>
<
@H_
618_77@controls:TreeViewIte
m.HeaderTemplate
>
<
@H_
618_77@DataTemplate
>
<
@H_
618_77@TextBlock
Text
="level 3"
FontWeight
="Bold"
/>
</
@H_
618_77@DataTemplate
>
</
@H_
618_77@controls:TreeViewIte
m.HeaderTemplate
>
</
@H_
618_77@controls:TreeViewItem
>
</
@H_
618_77@controls:TreeViewItem
>
</
@H_
618_77@controls:TreeViewItem
>
</
@H_
618_77@controls:TreeView
>
</
@H_
618_77@StackPanel
>
</
@H_
618_77@Grid
>
</
@H_
618_77@navigation:Page
>