开发者

How to get the background in setter?

how to get the background of a control in the setter. Eg. How to the get the Background of TextBox in the Setter?

 <Setter TargetName="Border" Property="Background" Value="{TemplateBinding Background}"/>

This statement will give an error "Expression type is note valid style value". Is there any way to g开发者_StackOverflow社区et the background property in the setter?


Try,

<Style TargetType={x:Type TextBox}>
  <Setter Property="Background" Value="Azure" />
</Style>

Is this what you are trying ??

Sudarsan Srinivasan

Update related to the first comment on this answer

If you want to do ElementBinding,

Sudarsan Srinivasan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜