[英]Change button style in Universal Windows Platform
I've tried to make a simple C# UWP application and I don't know how to remove the gray background when my mouse is over the button. 我试图制作一个简单的C#UWP应用程序,当鼠标悬停在按钮上时,我不知道如何删除灰色背景。
How I do that? 我怎么做的?
(remember: it's an UWP for Windows 10 platform , not Windows Phone 8.1 or WPF) (记住:它是适用于Windows 10平台的UWP,而不是Windows Phone 8.1或WPF)
Follow these steps: 跟着这些步骤:
Then insert it in your ResourceDictionary.xaml format should look like this: 然后将它插入您的ResourceDictionary.xaml格式应如下所示:
<ResourceDictionary><Style></Style></ResourceDictionary>
3. Give the Style a key like this: 3.给Style一个这样的键:
<Style x:Key="MyCustomButton"></Style>
4. Go to App.xaml edit it by adding the Resource Dictionary like this: 4.转到App.xaml,通过添加资源字典来编辑它,如下所示:
<Application.Resources>
<ResourceDictionary Source="Resources.xaml"></ResourceDictionary>
</Application.Resources>
The Source of the ResourceDictionary is the Name of your ResourceDictionary file. ResourceDictionary的Source是ResourceDictionary文件的名称。
<Button Style="{StaticResource MyCustomButton}"></Button>
<Button Style="{StaticResource MyCustomButton}"></Button>
There is a more easy solution if you use Blend for Visual Studio there you can edit this stuff more quickly but to keep the structure and for learning it the solution above is the better one. 有一个更简单的解决方案,如果你使用Blend for Visual Studio,你可以更快地编辑这些东西,但为了保持结构和学习它,上面的解决方案是更好的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.