手机8超链接按钮样式

时间:2013-03-26 07:55:32

标签: xaml windows-phone-8

对于hyperlinkBut​​ton样式有什么好的例子 我找到了下面的那个,但是处于按下状态我得到错误,我的超链接按钮是2行,如果我不使用这个样式,我得到2行2下划线但是如果我使用样式只有最后一行加下划线 我想要的风格是我让两条线都加下划线,当点击时,前景会将颜色变为白色而不是手机强调颜色 这是风格

<Style x:Key="HyperlinkButtonStyle" TargetType="HyperlinkButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="HyperlinkButton">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="TextElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="White"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="TextElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border Background="{TemplateBinding Background}" 
                                 Margin="{StaticResource PhoneHorizontalMargin}" BorderThickness="0,0,0,0"
                                 Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding Foreground}">
                            <ContentPresenter 
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

0 个答案:

没有答案