code_junkie

c# How can I expand an item within a ListView to occupy multiple lines?

Nov 12th, 2011
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <ListBox ItemsSource="{Binding}">
  2. <ListBox.ItemTemplate>
  3. <DataTemplate>
  4. <Grid>
  5. <Grid.RowDefinitions>
  6. <RowDefinition></RowDefinition>
  7. <RowDefinition></RowDefinition>
  8. </Grid.RowDefinitions>
  9.  
  10. <Grid Grid.Row="0" Height="20" >
  11. <TextBlock Text="Not Selected"></TextBlock>
  12. </Grid>
  13. <Grid x:Name="selectedOnlyGrid" Grid.Row="1" Visibility="Collapsed">
  14. <TextBlock Text="Selected"></TextBlock>
  15. </Grid>
  16.  
  17. </Grid>
  18.  
  19. <DataTemplate.Triggers>
  20. <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}, AncestorLevel=1}, Path=IsSelected}" Value="True">
  21. <Setter Property="Visibility" Value="Visible" TargetName="selectedOnlyGrid" />
  22. </DataTrigger>
  23. </DataTemplate.Triggers>
  24. </DataTemplate>
  25. </ListBox.ItemTemplate>
  26. </ListBox>
Add Comment
Please, Sign In to add comment