话说这个书无意间看到的,所以就拿来保留一下,说不定会用上。不过看到这么多密密麻麻的有点头大,等什么时候再慢慢看
文章来源,源文有效果图看
http://www.tuxi.com.cn/6-158-1584145.html
代码
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:my="clr-namespace:System.windows.Controls;assembly=System.windows.Controls.Toolkit" <!--TreeVIEwItem--> <Style targettype="sdk:TreeVIEwItem"> <Setter Property="padding" Value="0"/> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Background" Value="transparent"/> <Setter Property="borderThickness" Value="0"/> <Setter Property="Cursor" Value="Arrow"/> <Setter Property="IsTabStop" Value="True"/> <Setter Property="TabNavigation" Value="Once"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate targettype="sdk:TreeVIEwItem"> <StackPanel Background="{x:Null}"> <StackPanel.Resources> <my:TreeVIEwItemIndentationConverter x:Key="IndentConverter"/> </StackPanel.Resources> <visualstatemanager.VisualStateGroups> <VisualStateGroup x:name="CommonStates"> <VisualState x:name="normal"/> <VisualState x:name="MouSEOver"> <Storyboard> <DoubleAnimation Duration="0" Storyboard.Targetname="Hover" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> <VisualState x:name="pressed"/> <VisualState x:name="Disabled"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.Targetname="header" Storyboard.TargetProperty="Foreground" Duration="0"> <discreteObjectKeyFrame KeyTime="0"> <discreteObjectKeyFrame.Value> <SolIDcolorBrush color="#FF999999"/> </discreteObjectKeyFrame.Value> </discreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.Targetname="Content" Storyboard.TargetProperty="Foreground" Duration="0"> <discreteObjectKeyFrame KeyTime="0"> <discreteObjectKeyFrame.Value> <SolIDcolorBrush color="#FF999999"/> </discreteObjectKeyFrame.Value> </discreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:name="SelectionStates"> <VisualState x:name="Unselected"/> <VisualState x:name="Selected"> <Storyboard> <DoubleAnimation Duration="0" Storyboard.Targetname="Selection" Storyboard.TargetProperty="Opacity" To="1"/> </Storyboard> </VisualState> <VisualState x:name="SelectedInactive"> <Storyboard> <DoubleAnimation Duration="0" Storyboard.Targetname="Selection" Storyboard.TargetProperty="Opacity" To=".8"/> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:name="HasItemsstates"> <VisualState x:name="HasItems"/> <VisualState x:name="NoItems"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.Targetname="Expanderbutton" Storyboard.TargetProperty="Visibility" Duration="0"> <discreteObjectKeyFrame KeyTime="0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:name="ExpansionStates"> <VisualState x:name="Collapsed"/> <VisualState x:name="Expanded"> <Storyboard> <!--<DoubleAnimation Duration="0:0:0.2" Storyboard.Targetname="ExpandedBackground" Storyboard.TargetProperty="Opacity" To="1" />--> <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.Targetname="ItemsHost" Storyboard.TargetProperty="Visibility"> <discreteObjectKeyFrame KeyTime="0:0:0.21" Value="Visible"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.Targetname="Hover" Storyboard.TargetProperty="Visibility"> <discreteObjectKeyFrame KeyTime="0:0:0.21" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </visualstatemanager.VisualStateGroups> <border Background="{x:Null}" CornerRadius="2"> <GrID> <Rectangle x:name="ExpandedBackground" stroke="#FFF1F8FC" HorizontalAlignment="Stretch" RadiusX="4" RadiusY="4" IsHitTestVisible="False" Opacity="0" GrID.ColumnSpan="3" Canvas.ZIndex="0"> <Rectangle.Fill> <linearGradIEntBrush StartPoint=".5,0" EndPoint=".5,1"> <GradIEntStop Offset="-4" color="#FFB4D2EB" /> <GradIEntStop Offset="1.4" color="#FFFFFFFF" /> </linearGradIEntBrush> </Rectangle.Fill> </Rectangle> <Rectangle x:name="Hover" stroke="#FFd8f0ff" strokeThickness="1" HorizontalAlignment="Stretch" RadiusX="4" RadiusY="4" IsHitTestVisible="False" Opacity="0" GrID.ColumnSpan="3" Canvas.ZIndex="0"> <Rectangle.Fill> <linearGradIEntBrush StartPoint=".5,1"> <GradIEntStop Offset="0" color="#ffe5f4ff" /> <GradIEntStop Offset="1" color="#FFd8f0ff" /> </linearGradIEntBrush> </Rectangle.Fill> </Rectangle> <Rectangle x:name="Selection" stroke="#FFfee69e" HorizontalAlignment="Stretch" RadiusX="4" RadiusY="4" IsHitTestVisible="False" Opacity="0" GrID.ColumnSpan="3" Canvas.ZIndex="0" > <Rectangle.Fill> <linearGradIEntBrush> <GradIEntStop Offset="0" color="#FFfff2ca" /> <GradIEntStop Offset="1" color="#FFfee69e" /> </linearGradIEntBrush> </Rectangle.Fill> </Rectangle> <button x:name="header" ClickMode="Hover" WIDth="auto" Background="{TemplateBinding Background}" Cursor="{TemplateBinding Cursor}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsTabStop="False" TabNavigation="Once"> <button.Template> <ControlTemplate targettype="button"> <GrID Background="{TemplateBinding Background}"> <visualstatemanager.VisualStateGroups> <VisualStateGroup x:name="CommonStates"> <VisualState x:name="normal"/> <VisualState x:name="pressed" /> <VisualState x:name="Disabled"> <Storyboard> <DoubleAnimation Storyboard.Targetname="Content" Storyboard.TargetProperty="Opacity" Duration="0" To=".55"/> </Storyboard> </VisualState> </VisualStateGroup> </visualstatemanager.VisualStateGroups> <ContentPresenter x:name="Content" Cursor="{TemplateBinding Cursor}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="left" margin="{TemplateBinding padding}"/> </GrID> </ControlTemplate> </button.Template> <button.Content> <border borderThickness="0" margin="10 0 0 0"> <GrID margin="{Binding relativeSource={relativeSource TemplatedParent},Converter={StaticResource IndentConverter}}"> <GrID.ColumnDeFinitions> <ColumnDeFinition WIDth="15"/> <ColumnDeFinition WIDth="*"/> </GrID.ColumnDeFinitions> <Togglebutton x:name="Expanderbutton" HorizontalAlignment="Center" VerticalAlignment="Stretch" IsTabStop="False" TabNavigation="Once"> <Togglebutton.Template> <ControlTemplate targettype="Togglebutton"> <GrID x:name="Root" Background="transparent"> <visualstatemanager.VisualStateGroups> <VisualStateGroup x:name="CommonStates"> <VisualState x:name="normal"/> <VisualState x:name="MouSEOver"> <Storyboard> <colorAnimation Storyboard.Targetname="UncheckedVisual" Storyboard.TargetProperty="(Path.stroke).color" To="#FF1BBBFA" Duration="0"/> </Storyboard> </VisualState> <VisualState x:name="Disabled"> <Storyboard> <DoubleAnimation Storyboard.Targetname="Root" Storyboard.TargetProperty="Opacity" To=".7" Duration="0"/> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:name="CheckStates"> <VisualState x:name="Unchecked"/> <VisualState x:name="Checked"> <Storyboard> <DoubleAnimation Storyboard.Targetname="UncheckedVisual" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/> <DoubleAnimation Storyboard.Targetname="CheckedVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/> </Storyboard> </VisualState> </VisualStateGroup> </visualstatemanager.VisualStateGroups> <GrID HorizontalAlignment="Right" margin="2 2 5 2"> <Path x:name="UncheckedVisual" WIDth="6" Height="9" Fill="#FFFFFFFF" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M 0,0 L 0,9 L 5,4.5 Z" strokeThickness="1" strokelineJoin="Miter"> <Path.stroke> <SolIDcolorBrush color="#FF989898"/> </Path.stroke> </Path> <Path x:name="CheckedVisual" Opacity="0" WIDth="6" Height="6" Fill="#FF262626" VerticalAlignment="Center" HorizontalAlignment="Center" Data="M 6,0 L 6,6 L 0,6 Z" strokelineJoin="Miter"/> </GrID> </GrID> </ControlTemplate> </Togglebutton.Template> </Togglebutton> <ContentControl x:name="Content" GrID.Column="1" Cursor="{TemplateBinding Cursor}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" padding="{TemplateBinding padding}"> <ContentControl.Content> <ContentPresenter Content="{TemplateBinding header}" ContentTemplate="{TemplateBinding headerTemplate}"/> </ContentControl.Content> </ContentControl> </GrID> </border> </button.Content> </button> </GrID> </border> <border x:name="ValIDation" borderThickness="{TemplateBinding borderThickness}" borderBrush="#Ffdb000C" CornerRadius="2" Visibility="Collapsed"> <tooltipService.tooltip> <tooltip x:name="ValIDationtooltip" Placement="Right" PlacementTarget="{Binding Elementname=Content}" DataContext="{Binding relativeSource={relativeSource TemplatedParent}}" IsHitTestVisible="True"/> </tooltipService.tooltip> <GrID WIDth="10" Height="10" HorizontalAlignment="Right" margin="0,-4,0" VerticalAlignment="top" Background="transparent"> <Path margin="-1,3,0" Fill="#FFDC000C" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 Z"/> <Path margin="-1,0" Fill="#FFFFFFFF" Data="M 0,0 L2,0 L 8,6 L8,8"/> </GrID> </border> <ItemsPresenter x:name="ItemsHost" Visibility="Collapsed"/> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>本篇文章来源于突袭网[www.tuxi.com.cn] 原文链接:http://www.tuxi.com.cn/6-158-1584145.HTML总结
以上是内存溢出为你收集整理的Silverlight - TreeView样式大全全部内容,希望文章能够帮你解决Silverlight - TreeView样式大全所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)