Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Dr TJ's answer is right enough. Going down that route you'd have to wrap <code>ObservableCollection&lt;T&gt;</code> and implement a BeforeDelete event,..then you could use an <code>EventTrigger</code> to control the storyboards.</p> <p>That's a right pain though. You're probably better creating a <code>DataTemplate</code> and handling the <code>FrameworkElement.Loaded</code> and <code>FrameworkElement.Unloaded</code> events in an <code>EventTrigger</code>. </p> <p>I've put a quick sample together for you below. You'd have to sort out the remove code yourself but I'm sure you're up to it.</p> <pre><code> &lt;ListBox&gt; &lt;ListBox.ItemsSource&gt; &lt;x:Array Type="sys:String"&gt; &lt;sys:String&gt;One&lt;/sys:String&gt; &lt;sys:String&gt;Two&lt;/sys:String&gt; &lt;sys:String&gt;Three&lt;/sys:String&gt; &lt;sys:String&gt;Four&lt;/sys:String&gt; &lt;sys:String&gt;Five&lt;/sys:String&gt; &lt;/x:Array&gt; &lt;/ListBox.ItemsSource&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding}" Opacity="0"&gt; &lt;TextBlock.Triggers&gt; &lt;EventTrigger RoutedEvent="FrameworkElement.Loaded"&gt; &lt;BeginStoryboard&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:02" From="0" To="1" /&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/EventTrigger&gt; &lt;EventTrigger RoutedEvent="FrameworkElement.Unloaded"&gt; &lt;BeginStoryboard&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:02" From="1" To="0" /&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/EventTrigger&gt; &lt;/TextBlock.Triggers&gt; &lt;/TextBlock&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; </code></pre> <p>HTH, Stimul8d</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload