小编han*_*ali的帖子

在UWP app后面的代码中定义按钮的样式

我尝试在后面的代码中为我的按钮应用样式,如下所示:

使用Windows.UI.Xaml.Markup;

 MenuButton2.Style = ButtonStyle();

     private Style ButtonStyle()
            {
                string xaml =
                  "<Style  " +
"xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' " +
                    "xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' " +
                    "xmlns:d = 'http://schemas.microsoft.com/expression/blend/2008' " +
                    "TargetType='Button'>" +
                     "<Setter Property='Foreground' Value='#e6e6e6'/>" +
                   " < Setter Property = 'Template' >" +
                    " < Setter.Value >" +
                         "< ControlTemplate TargetType = 'Button' >" +
                              "< Grid >" +
                                  "< VisualStateManager.VisualStateGroups >" +
                                      "< VisualStateGroup x: Name = 'CommonStates' >" +
                                            "< VisualState x: Name = 'Normal' />" +
                                              "< VisualState x: Name …
Run Code Online (Sandbox Code Playgroud)

c# xaml win-universal-app

1
推荐指数
1
解决办法
3193
查看次数

标签 统计

c# ×1

win-universal-app ×1

xaml ×1