如何在Silverlight中将数据绑定到DataTrigger

时间:2014-04-21 14:46:10

标签: c# silverlight binding datagrid datatrigger

我填充Silverlight DataGrid,如

 grdActivities.ItemsSource = items;

XAML

<datagrid:DataGrid   x:Name="grdActivities" AutoGenerateColumns="False">
   <sdk:DataGrid.RowStyle>
      <Style TargetType="sdk:DataGridRow">
         <iv:Interaction.Triggers>
           <ia:DataTrigger Binding=IsMarkedToDelete" 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>
  <datagrid:DataGrid.Columns>
   // Some columns are here           
  </datagrid:DataGrid.Columns>
</datagrid:DataGrid>

如果相对Binding我无法正常工作?

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

您的Binding必须包含关键字&#34; Binding&#34;。

<ia:DataTrigger Binding="{Binding Path=IsMarkedToDelete}" Value="True">