当前位置: 动力学知识库 > 问答 > 编程问答 >

Silverlight style trigger throwing error in blend

问题描述:

I am styling a listbox in silverlight and the trigger I am making will not work in Blend. Here is the code.

<Style TargetType="ListBoxItem" x:Key="ContainerStyle">

<Style.Triggers>

<Trigger Property="IsSelected" Value="True">

<Setter Property="ContentTemplate" Value="{StaticResource SelectedTemplate}" />

</Trigger>

</Style.Triggers>

<Setter Property="ContentTemplate" Value="{StaticResource ItemTemplate}" />

</Style>

Blend just says "The member Triggers is not recognized or is not accessible.

网友答案:

That would be because the Style class does not have a Triggers collection. Only derivatives of FrameworkElement have a Triggers collection and in Silverlight only Loaded trigger is recognized.

分享给朋友:
您可能感兴趣的文章:
随机阅读: