问题描述
我写了一种样式来突出显示某些按钮,具体取决于选择了哪个Tab,所以我将DataTrigger
绑定到TabControl的Selectedindex。
样式代码如下:
<Style targettype="Button" x:Key="MainPagetoolMenuButtonIdx0">
<Style.Triggers>
<DataTrigger Binding="{Binding Selectedindex,ElementName=TabsProgrammingReport}" Value="0">
<Setter Property="Foreground" Value="{StaticResource BorderColorAccent}"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderColorAccent}"/>
</DataTrigger>
</Style.Triggers>
</Style>
这正常工作,但是我希望能够向样式传递参数以设置Value
的{{1}}。
我试图将DataTrigger
绑定到Value
属性,但是它不起作用。
此刻,我被迫用不同的Tag
创建多种样式。
相反,我想只使用一种样式,并编写类似的内容:
Values="x"
这可能吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)