有关XAML中的样式的问题 [英] A question about Style in XAML
本文介绍了有关XAML中的样式的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
如何将Margin
属性设置为数字,例如在窗口中使用xaml代码创建了带有全局Style
的10控件?
我尝试了这个,但是出现错误...
Hi everybody
How can set Margin
property to a number, for example 10 with global Style
to controls has created in window under xaml code?
I tried this, but get error...
<Window.Resources>
<Style TargetType="UIElement.Control">
<Setter Property="Margin" Value="10"/>
</Style>
</Window.Resources>
有解决方案吗?
在高级中感谢:)
Are there solution?
Thanks in advanced:)
推荐答案
尝试以下操作:
Try this:
<Style TargetType="Control">
<Setter Property="Margin">
Value="10" />
</Setter>
</Style>
或这样:
or this:
<Style TargetType="{x:Type Control}">
<Setter Property="Margin">
Value="10" />
</Setter>
</style>
问题是Control不在UIElement下. UIElement是另一个类,不包含Margin属性.
The problem is that Control is not under UIElement. UIElement is another class and does not contain a Margin property.
这篇关于有关XAML中的样式的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文