Frage

I have a trigger in WPF, i want to use the same kind in Silverlight version, can any one please help me to write the below sample WPF trigger into Silverlight?

 <ControlTemplate.Triggers>
        <Trigger Property="pop:Indicator.HaveResults" Value="True">
            <Setter Property="Visibility" TargetName="PART_Symbol" Value="Visible"/>
            <Setter Property="Opacity" TargetName="EditIndicator" Value="0" />
        </Trigger>
    </ControlTemplate.Triggers>

Thank you in advance.

War es hilfreich?

Lösung

I'm not sure that specifically in this case a simple binding won't do the job better, but, I suspect he following should work:

Add references to the assemblies in the following namespaces (and the namespace)

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ei="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"

and then

<i:Interaction.Triggers>
  <ei:DataTrigger Binding="{Binding Indicator.HaveResults}" Value="True">
    <ei:DataTrigger.Actions>
      <ei:ChangePropertyAction TargetName="X" PropertyName="Y" Value="Z"/>
    </ei:DataTrigger.Actions>
  </ei:DataTrigger>
</i:Interaction.Triggers>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top