
<UserControl x:Class="HiIDeSRM.WIDSModule.BiometricStatusIndicator" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Style targettype="{x:Type border}"> <Setter Property="WIDth" Value="10"/> </Style> <StackPanel OrIEntation="Horizontal" x:name="Panel"> <border Height="50" margin="1"/> <border Height="10" margin="1"/> <border Height="10" margin="1"/> <border Height="10" margin="1"/> </StackPanel></UserControl>解决方法 首先,将您的样式放入.Resources标记 – 它可以是几乎任何控件标记的子代(例如,border,usercontrol,grID等) 第二,您可以在标记中指定样式,但由于您没有在资源上声明x:键,因此该样式将应用于此控件中的所有边框.
<UserControl.Resources> <Style targettype="{x:Type border}"> <Setter Property="WIDth" Value="10"/> </Style></UserControl.Resources> 请注意,silverlight的语法不同.而不是targettype =“{x:Type border}”你会使用targettype =“border”
总结以上是内存溢出为你收集整理的如何在WPF UserControl中创建样式?全部内容,希望文章能够帮你解决如何在WPF UserControl中创建样式?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)