1

The below is my WPF ControlTemplate.Triggers and i have changed the code in silverlight with the Interactivity.Interaction.Triggers and it is not working . can anyone pls help me.

WPF Code:

<ControlTemplate.Triggers>
                    <Trigger Property="HasItems" Value="false">
                        <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="false">
                        <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                    </Trigger>
                    <Trigger Property="IsGrouping" Value="true">
                        <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                    </Trigger>
                    <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
                        <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4"/>
                        <Setter TargetName="DropDownBorder" Property="Margin" Value="0,2,0,0"/>
                    </Trigger>
                    <Trigger Property="IsEditable"
                   Value="true">
                        <Setter Property="IsTabStop" Value="false"/>
                        <Setter TargetName="EditableTextBox" Property="Visibility"    Value="Visible"/>
                        <Setter TargetName="Presenter" Property="Visibility" Value="Hidden"/>
                    </Trigger>
                </ControlTemplate.Triggers>

My Silverligh code:

   <i:Interaction.Triggers>                   
                    <i:EventTrigger EventName="HasItems" >
                        <ic:ChangePropertyAction TargetName="DropDownBorder" PropertyName="MinHeight" Value="95" />
                    </i:EventTrigger>

                    <i:EventTrigger SourceName="Popup" >
                        <ic:ChangePropertyAction TargetName="DropDownBorder" PropertyName="CornerRadius" Value="4" />
                        <ic:ChangePropertyAction TargetName="DropDownBorder" PropertyName="Margin" Value="0,2,0,0"/>
                    </i:EventTrigger>

                    <i:EventTrigger EventName="Popup.AllowsTransparency">
                        <ic:ChangePropertyAction TargetName="Border" PropertyName="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                        <ic:ChangePropertyAction TargetName="Border" PropertyName="BorderBrush" Value="{StaticResource DisabledBackgroundBrush}" />
                        <ic:ChangePropertyAction TargetName="Border" PropertyName="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>

Thanks in advance!!!

Prabhakaran
  • 1,264
  • 2
  • 20
  • 47

2 Answers2

0

Looking at your Silverlignt code one thing i got is ....

 <i:EventTrigger EventName="HasItems" >    
                     <ic:ChangePropertyAction TargetName="DropDownBorder"    
                      PropertyName="MinHeight" Value="95" />                     
</i:EventTrigger> 

i believe HasItems is not an event its a property

Check this Answer and the comments too :) and this link also might help....

Community
  • 1
  • 1
Ankesh
  • 4,847
  • 4
  • 38
  • 76
  • Ya you are correct it is not an event ..Is there any other way to handle this and also i will check those link.. – Prabhakaran Nov 17 '11 at 08:29
0

It looks like you need to use Microsoft.Expression.Interactivity.Core.DataTrigger (which is the equivalent of Trigger) rather than EventTrigger.

Samuel Jack
  • 32,712
  • 16
  • 118
  • 155