【发布时间】:2014-02-05 10:28:28
【问题描述】:
使用表达式混合 2013 将数据触发器附加到 UI 元素的正确过程是什么?
如果我直接在 xaml 中编写 datatrigger 效果很好,但我想知道是否有“视觉方式”来做到这一点。
例如,创建一个 listboxitem 样式我正在做这样的事情:
<DataTemplate x:Key="BoundingBoxTemplate" DataType="{x:Type is:BoundingBoxViewModel}" >
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsBorderVisible}" Value="True">
<Setter TargetName="InsideRectangle" Property="Stroke" Value="Blue" />
</DataTrigger>
</DataTemplate.Triggers>
<Grid>
<Rectangle x:Name="InsideRectangle"
Width="{Binding Width}"
Height="{Binding Height}"
Fill="Black"
SnapsToDevicePixels="True" />
</Grid>
</DataTemplate>
谢谢 洛伦佐
【问题讨论】:
标签: wpf xaml expression-blend blend datatrigger