【发布时间】:2011-10-21 11:53:00
【问题描述】:
这是我的文本块。
<Image x:Name:imgAnother/>
<TextBlock>
this is my text block
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="TextDecorations" Value="None"/>
<Style.Triggers>
<Trigger Property="TextBlock.IsMouseOver" Value="True">
<Setter Property="Foreground" Value="RoyalBlue"/>
<!--I like to insert a code at here that changes another control's property...-->
</Trigger>
<Trigger Property="TextBlock.IsMouseOver" Value="False">
<Setter Property="Foreground" Value="#FF808080"/>
<!--..and this line too.-->
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
我喜欢制作一个可以更改另一个控件属性的 xaml 代码,例如“imgAnother”。
我该怎么做?
【问题讨论】:
-
那张图片(或您的意思的控件)在哪里?
-
基本上,我想在同一个窗口中更改另一个控件的属性。而且,控件也可以放在应用程序资源、窗口资源、控件资源中。