问题描述
它可能吗?
我不明白为什么这段代码工作正常:
< ;样式x:Key =MyStyleTargetType ={x:Type Canvas}>
< Setter Property =WidthValue =125/>
< Setter Property =HeightValue =55/>
< Setter Property =BackgroundValue =White/>
< / Style>
但是这个错了:
< Style x:Key =MyStyle>
< Style.Resources>
< Style TargetType =Canvas>
< Setter Property =宽度值=125/>
< Setter Property =HeightValue =55/>
< Setter Property =背景值=白色/>
< / Style>
< /Style.Resources>
< / Style> ;
我的尝试:
案例是我想在最后的MyStyle中注入几种类型,例如文本框,省略号等。
我解释了自己那么?
Its possible ?
I don't understand why this code works fine:
<Style x:Key="MyStyle" TargetType="{x:Type Canvas}">
<Setter Property="Width" Value="125" />
<Setter Property="Height" Value="55" />
<Setter Property="Background" Value="White" />
</Style>
But this one its wrong:
<Style x:Key="MyStyle">
<Style.Resources>
<Style TargetType="Canvas">
<Setter Property="Width" Value="125" />
<Setter Property="Height" Value="55" />
<Setter Property="Background" Value="White" />
</Style>
</Style.Resources>
</Style>
What I have tried:
The case is I want to inject several types in this last MyStyle, such as textboxes, ellipses, etc..
I explained myself well?
这篇关于如何使用相同的键来处理不同的目标类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!