当前第2页 返回上一页
1) 创建文件夹Themes右键添加新建项visual C# àxamlà资源字典 style.xaml

2) 在style.xaml写样式例如
1 2 3 4 5 6 7 8 | <Style TargetType= "Button" x:Key= "gft_FormBtm" >
<Setter Property= "Background" Value= "OrangeRed" ></Setter>
<Setter Property= "Height" Value= "50" ></Setter>
<Setter Property= "FontSize" Value= "16" ></Setter>
<Setter Property= "Foreground" Value= "White" ></Setter>
<Setter Property= "HorizontalAlignment" Value= "Center" ></Setter>
<Setter Property= "MinWidth" Value= "300" ></Setter>
</Style>
|
3) 在App.xaml文件中指定资源
1 2 3 4 5 6 7 8 | <!--4.使用样式文件-->
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source= "Themes/style.xaml" ></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
|
4) 在xaml界面中使用样式文件
1 | 1 <Button x:Name= "btnSubmit" Content= "同意以上协议并注册" HorizontalAlignment= "Center" Click= "btnSubmit_Click" Style= "{StaticResource gft_FormBtm}" />
|
以上就是UWP中设置控件样式四种方法 的详细内容!
返回前面的内容
相关阅读 >>
使用一个wpf程序起调一个uwp程序
实现asp.net返回上一页有哪些实例?
分享html元素调用服务器实例
uwp中设置控件样式四种方法
c# 如何生成自定义图片?c# 生成自定义图片方法
克隆对象的方法实例教程
有关.net mvc长轮询的实现方法
.net winform的gdi双缓冲的实现方法_实用技巧
task用法之启动方法实例
总结用表达式数调用的实例代码
更多相关阅读请进入《方法》频道 >>
清华大学出版社
作者:[美]克里斯琴·内格尔(Christian Nagel)著。出版时间:2019年3月。
转载请注明出处:木庄网络博客 » UWP中设置控件样式四种方法