1

How to convert that WPF XAML code to Silverlight XAML version?

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

I found that I have to apply Interaction.Triggers but it is unclear how to do it practically. (code sample)

I have added two references are

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

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

And I am at point to finish it but I am not sure how...

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

Thanks for help!

P.S. It seems like I got something but it is not working...

<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>
Community
  • 1
  • 1
NoWar
  • 36,338
  • 80
  • 323
  • 498
  • Why hide rows? Isn\`t it better to show only items which are not deleted? It\`s even easier from WPF-SL compability point of view, just edit `DataGrid` ItemsSource. – icebat Apr 21 '14 at 14:05
  • @TYY that's not correct, I use datatriggers all the time in silverlight. – Chris W. Apr 21 '14 at 14:09
  • @TTY Thanks for the input could you take alook at my updated question, please or even better provide solution for VisualStateManger , please? – NoWar Apr 21 '14 at 14:10
  • @ChrisW. Hey Chris could just help me to finish my code please? – NoWar Apr 21 '14 at 14:11
  • Sure thing, I think you're looking more for [this](http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.collapserowgroup(v=vs.95).aspx) to make life easier. – Chris W. Apr 21 '14 at 14:12
  • @ChrisW. Cool, cool! Could you play with my code around and put the answer so I can vote +1 it? Cannot get how I have to change code after DataTrigger .... – NoWar Apr 21 '14 at 14:16

0 Answers0