简体   繁体   English

WP7如何在C#中添加样式

[英]WP7 How to add the style in C#

I have created a style for button control in App.xaml("RoundButton"). 我在App.xaml(“ RoundButton”)中为按钮控件创建了样式。 I want to create a button in C# code and set the style of the button to the one created in App.xaml file. 我想用C#代码创建一个按钮,并将按钮的样式设置为App.xaml文件中创建的按钮。 Is it possible to do this? 是否有可能做到这一点?

Button btn = new Button();
btn.Style= (Style)App.Current.Resources["RoundButton"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM