2011-11-17 93 views
1

下面是我的WPF ControlTemplate.Triggers,我用Interactivity.Interaction.Triggers更改了Silverlight中的代碼,但它不工作。 任何人都可以幫助我。相當於Silverlight中的WPF ControlTemplate.Triggers

WPF代碼:

<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> 

我Silverligh代碼:

<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> 

在此先感謝!

回答

0

看你Silverlignt代碼有一件事我是得了....

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

我相信HasItems是不是一個事件,它的屬性

Check this Answer and the comments too :),這link也可能有助於....

+0

雅你是正確的,這不是一個事件..是否有任何其他方式來處理這一點,我也會檢查這些鏈接.. – Prabhakaran