Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
415
Animate removal of item from XamDataGrid
posted

I wrote an extremely simple style that I thought would animate an item's removal from a XamDataGrid. Here is my style:

<Style TargetType="{x:Type igDP:DataRecordPresenter}" x:Key="DataRecordPresenterStyle">
   <Style.Triggers>
      <EventTrigger RoutedEvent="FrameworkElement.Unloaded">
         <BeginStoryboard>
            <Storyboard>
               <DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:01" To="0" />
            </Storyboard>
         </BeginStoryboard>
      </EventTrigger>
    </Style.Triggers>
</Style>

I'm not sure why it doesn't work. I suspect that the Unloaded handler isn't getting invoked when I remove the item. By the way I am data binding my XamDataGrid to an ObservableCollection of Device objects (my class). I just call devices.Remove to remove the item. I'm guessing that the items Unloaded handler isn't getting called but I can't be sure as I can't debug the XAML.

Is there a way to animate an item removal from XamDataGrid.

Ideally, I would want to animate the Height value until the item is zero but a fade will work OK as well.

Please see my attached project for a non-working attempt.

Thanks

Louis

XamDataGridAnimation.zip