方便日后项目中提取样式代码,记录在此博客中
样式代码如下:
<Style x:Key="RadiobuttonStyle1" targettype="Radiobutton"> <Setter Property="Background" Value="#FF448DCA"/> <Setter Property="Foreground" Value="#FF556676"/> <Setter Property="HorizontalContentAlignment" Value="left"/> <Setter Property="VerticalContentAlignment" Value="top"/> <Setter Property="padding" Value="4,1,0"/> <Setter Property="borderThickness" Value="1"/> <Setter Property="borderBrush" Value="#41a3ef" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate targettype="Radiobutton"> <GrID> <GrID.ColumnDeFinitions> <ColumnDeFinition WIDth="16"/> <ColumnDeFinition WIDth="*"/> </GrID.ColumnDeFinitions> <visualstatemanager.VisualStateGroups> <VisualStateGroup x:name="CommonStates"> <VisualState x:name="normal"/> <VisualState x:name="MouSEOver"> <Storyboard> <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.Targetname="BackgroundOverlay"/> <!-- <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.Targetname="BoxMIDdleBackground"/> --> </Storyboard> </VisualState> <VisualState x:name="pressed"> <Storyboard> <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.Targetname="BackgroundOverlay"/> <!-- <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.Targetname="BoxMIDdleBackground"/> --> </Storyboard> </VisualState> <VisualState x:name="Disabled"> <Storyboard> <DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.Targetname="contentPresenter"/> <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.Targetname="DisabledVisualElement"/> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:name="CheckStates"> <VisualState x:name="Checked"> <Storyboard> <!-- <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.Targetname="CheckIcon"/> --> <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.Targetname="BoxMIDdle" /> </Storyboard> </VisualState> <VisualState x:name="Unchecked"/> </VisualStateGroup> <VisualStateGroup x:name="Focusstates"> <VisualState x:name="Focused"> <Storyboard> <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.Targetname="ContentFocusVisualElement"/> </Storyboard> </VisualState> <VisualState x:name="Unfocused"/> </VisualStateGroup> <VisualStateGroup x:name="ValIDationStates"> <VisualState x:name="ValID"/> <VisualState x:name="InvalIDUnfocused"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.Targetname="ValIDationErrorElement"> <discreteObjectKeyFrame KeyTime="0"> <discreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </discreteObjectKeyFrame.Value> </discreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:name="InvalIDFocused"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.Targetname="ValIDationErrorElement"> <discreteObjectKeyFrame KeyTime="0"> <discreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </discreteObjectKeyFrame.Value> </discreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.Targetname="valIDationtooltip"> <discreteObjectKeyFrame KeyTime="0"> <discreteObjectKeyFrame.Value> <System:Boolean>True</System:Boolean> </discreteObjectKeyFrame.Value> </discreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </visualstatemanager.VisualStateGroups> <GrID HorizontalAlignment="left" VerticalAlignment="top"> <Ellipse x:name="BackgroundOverlay" Fill="#dff1ff" Height="14" margin="1" Opacity="0" stroke="transparent" strokeThickness="0" WIDth="14"/> <Ellipse x:name="Background" Fill="transparent" Height="14" margin="1" stroke="{TemplateBinding borderBrush}" strokeThickness="{TemplateBinding borderThickness}" WIDth="14"/> <!-- <Ellipse x:name="BoxMIDdleBackground" Fill="transparent" Height="10" stroke="transparent" strokeThickness="0" WIDth="10"/> --> <Ellipse x:name="BoxMIDdle" Opacity="0" Height="6" strokeThickness="0" WIDth="6" Fill="#41a3ef" stroke="transparent" /> <!-- <Ellipse x:name="BoxMIDdleline" Height="10" Opacity="0" stroke="transparent" strokeThickness="0" WIDth="10"/> --> <!-- <Ellipse x:name="CheckIcon" Fill="#FF333333" Height="4" Opacity="0" WIDth="4"/> --> <Ellipse x:name="DisabledVisualElement" Fill="#FFFFFFFF" Height="14" Opacity="0" WIDth="14"/> <Ellipse x:name="ContentFocusVisualElement" Height="16" IsHitTestVisible="false" Opacity="0" stroke="#FF6DBDD1" strokeThickness="1" WIDth="16"/> <GrID x:name="ValIDationErrorElement" tooltipService.PlacementTarget="{Binding relativeSource={relativeSource TemplatedParent}}" Visibility="Collapsed"> <tooltipService.tooltip> <tooltip x:name="valIDationtooltip" DataContext="{Binding relativeSource={relativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding relativeSource={relativeSource TemplatedParent}}" Template="{StaticResource ValIDationtooltipTemplate}"> <tooltip.Triggers> <EventTrigger RoutedEvent="Canvas.Loaded"> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" Storyboard.Targetname="valIDationtooltip"> <discreteObjectKeyFrame KeyTime="0"> <discreteObjectKeyFrame.Value> <System:Boolean>true</System:Boolean> </discreteObjectKeyFrame.Value> </discreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </tooltip.Triggers> </tooltip> </tooltipService.tooltip> <Ellipse Height="14" stroke="#Ffdb000C" strokeThickness="1" WIDth="14"/> <Ellipse Fill="#Ffdb000C" HorizontalAlignment="Right" Height="4" margin="0,-2,-1,0" VerticalAlignment="top" WIDth="4"/> <Ellipse Fill="transparent" HorizontalAlignment="Right" Height="10" margin="0,-5,-4,0" VerticalAlignment="top" WIDth="10"/> </GrID> </GrID> <ContentPresenter x:name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" GrID.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" margin="{TemplateBinding padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </GrID> </ControlTemplate> </Setter.Value> </Setter></Style>总结
以上是内存溢出为你收集整理的Silverlight的RadioButton样式--记录全部内容,希望文章能够帮你解决Silverlight的RadioButton样式--记录所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)