Silverlight中的触发器和DataGrid.RowStyle

时间:2014-04-21 13:26:38

标签: wpf silverlight xaml

如何将该WPF XAML代码转换为Silverlight XAML版本?

<DataGrid.RowStyle>
    <Style TargetType="{x:Type DataGridRow}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsDeleted}" Value="True">
                <Setter Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</DataGrid.RowStyle>

我发现我必须申请Interaction.Triggers,但目前还不清楚如何实际操作。 (code sample

我添加了两个引用

xmlns:ia="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" 

xmlns:iv="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 

我正准备完成它,但我不确定如何......

<sdk:DataGrid.RowStyle>
 <Style TargetType="sdk:DataGridRow">
    <iv:Interaction.Triggers>
       <ia:DataTrigger Binding="{Binding IsDeleted}" Value="True"  >
               ???? What should be done here?
       </ia:DataTrigger> 
    </iv:Interaction.Triggers>
 </Style>
</sdk:DataGrid.RowStyle>

感谢您的帮助!

P.S。好像我得到了一些东西,但它不起作用......

<sdk:DataGrid.RowStyle>
     <Style TargetType="sdk:DataGridRow">
        <iv:Interaction.Triggers>
           <ia:DataTrigger Binding="{Binding IsDeleted}" Value="True"  >
              <ia:ChangePropertyAction PropertyName="Visibility" >
                  <ia:ChangePropertyAction.Value>
                     <Visibility>Collapsed</Visibility>
                  </ia:ChangePropertyAction.Value>
              </ia:ChangePropertyAction>
           </ia:DataTrigger> 
        </iv:Interaction.Triggers>
     </Style>
    </sdk:DataGrid.RowStyle>

0 个答案:

没有答案