tags:

views:

32

answers:

2

How I can hide a item, binded on ItemSource of a ListView. I want to hide it dont remove it,. Is Possible???

+1  A: 

Use a style with a trigger to set the items visibility to collapsed.

Joel Lucsy
+1  A: 
<ItemsControl>
 <ItemTemplate>
  <DataTemplate>
   <Image Visibility='{Binding Converter=my:MaybeHideThisElementConverter}' />
   </Image>
  </DataTemplate>
 </ItemTemplate>
</ItemsControl>

What we're doing here is delegating the decision to your implementation of MaybeHideThisElementConverter. This is where you might return Collapsed if the User property of your object is null, or if the Count is an even number, or whatever custom logic your application requires. The converter will be passed each item in your collection, one by one, and you can return either Visibility.Collapsed or Visibility.Visible on a case by case basis.

Chris Hagan