通用应用程序TextBlockButtonStyle

城八郎

我将WinRT 8.1页面移至共享项目(通用应用程序)。但是样式“ TextBlockButtonStyle”在WP8.1应用程序中给出了例外。WP8.1是否不可用?如果不是,是否有一个列表可以提供提示,什么是常见样式,什么不是?

谢谢,

Zhao Min

Chubosaurus软件

只需在自己中添加样式。

App.xaml中


<Application.Resources>    
    <Style x:Key="TextBlockButtonStyle" TargetType="ButtonBase">
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ButtonBase">
                    <Grid Background="Transparent">
                        <ContentPresenter x:Name="Text" Content="{TemplateBinding Content}" />
                        <Rectangle
                        x:Name="FocusVisualWhite"
                        IsHitTestVisible="False"
                        Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}"
                        StrokeEndLineCap="Square"
                        StrokeDashArray="1,1"
                        Opacity="0"
                        StrokeDashOffset="1.5"/>
                        <Rectangle
                        x:Name="FocusVisualBlack"
                        IsHitTestVisible="False"
                        Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}"
                        StrokeEndLineCap="Square"
                        StrokeDashArray="1,1"
                        Opacity="0"
                        StrokeDashOffset="0.5"/>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPointerOverForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPressedForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPressedForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualWhite" Storyboard.TargetProperty="Opacity"/>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualBlack" Storyboard.TargetProperty="Opacity"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked"/>
                                <VisualState x:Name="Unchecked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Indeterminate"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</Application.Resources>

现在你可以做

<Button Style="{StaticResource TextBlockButtonStyle}" Content="Button 1" Height="200" Width="200"></Button>`


请记住,它将在“本地资源”中而不是系统资源中

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

什么是“通用应用程序”?

来自分类Dev

通用应用程序+蓝牙+ SPP

来自分类Dev

在通用应用程序中使用UICollectionView

来自分类Dev

SQLite Windows通用应用程序

来自分类Dev

通用应用程序中的动态表

来自分类Dev

通用Windows应用程序中的flipview

来自分类Dev

通用应用程序的Kal日历

来自分类Dev

Windows Store应用程序的通用会话

来自分类Dev

创建通用应用程序(iPhone / Ipad)

来自分类Dev

SQLite Windows通用应用程序

来自分类Dev

通用应用程序+蓝牙+ SPP

来自分类Dev

Windows通用应用程序SetTitleBar

来自分类Dev

通用应用程序MySQLConnector连接错误

来自分类Dev

Dotnetexe至Windows通用应用程序

来自分类Dev

通用应用程序的MySQL Connection的哪个程序集

来自分类Dev

通用Windows应用程序有可用的间谍程序吗?

来自分类Dev

如何通过通用Windows应用程序启动警报应用程序

来自分类Dev

从现有的iPhone应用程序创建通用应用程序

来自分类Dev

Windows通用应用程序(WIN 10)应用程序清单验证错误

来自分类Dev

将Windows Phone应用程序(Silverlight)移植/转换为通用应用程序

来自分类Dev

如何使通用Windows应用程序响应式UI(例如新闻应用程序)

来自分类Dev

SpringBoot应用程序:在JSP页面中访问通用应用程序属性

来自分类Dev

将多个单独的通用应用程序合并到一个主应用程序

来自分类Dev

仅将通用应用程序转换为Windows Phone应用程序

来自分类Dev

将Windows Phone应用程序(Silverlight)移植/转换为通用应用程序

来自分类Dev

Windows通用应用程序(WIN 10)应用程序清单验证错误

来自分类Dev

iOS-将iPad应用程序转换为通用应用程序-解决问题

来自分类Dev

将SQLite Windows窗体应用程序迁移到通用Windows应用程序(C#)

来自分类Dev

空白通用Windows应用程序和控制台应用程序之间的区别

Related 相关文章

  1. 1

    什么是“通用应用程序”?

  2. 2

    通用应用程序+蓝牙+ SPP

  3. 3

    在通用应用程序中使用UICollectionView

  4. 4

    SQLite Windows通用应用程序

  5. 5

    通用应用程序中的动态表

  6. 6

    通用Windows应用程序中的flipview

  7. 7

    通用应用程序的Kal日历

  8. 8

    Windows Store应用程序的通用会话

  9. 9

    创建通用应用程序(iPhone / Ipad)

  10. 10

    SQLite Windows通用应用程序

  11. 11

    通用应用程序+蓝牙+ SPP

  12. 12

    Windows通用应用程序SetTitleBar

  13. 13

    通用应用程序MySQLConnector连接错误

  14. 14

    Dotnetexe至Windows通用应用程序

  15. 15

    通用应用程序的MySQL Connection的哪个程序集

  16. 16

    通用Windows应用程序有可用的间谍程序吗?

  17. 17

    如何通过通用Windows应用程序启动警报应用程序

  18. 18

    从现有的iPhone应用程序创建通用应用程序

  19. 19

    Windows通用应用程序(WIN 10)应用程序清单验证错误

  20. 20

    将Windows Phone应用程序(Silverlight)移植/转换为通用应用程序

  21. 21

    如何使通用Windows应用程序响应式UI(例如新闻应用程序)

  22. 22

    SpringBoot应用程序:在JSP页面中访问通用应用程序属性

  23. 23

    将多个单独的通用应用程序合并到一个主应用程序

  24. 24

    仅将通用应用程序转换为Windows Phone应用程序

  25. 25

    将Windows Phone应用程序(Silverlight)移植/转换为通用应用程序

  26. 26

    Windows通用应用程序(WIN 10)应用程序清单验证错误

  27. 27

    iOS-将iPad应用程序转换为通用应用程序-解决问题

  28. 28

    将SQLite Windows窗体应用程序迁移到通用Windows应用程序(C#)

  29. 29

    空白通用Windows应用程序和控制台应用程序之间的区别

热门标签

归档