MVVM with animations (should I use VisualStateManager?)

Posted by kennethkryger on Stack Overflow See other posts from Stack Overflow or by kennethkryger
Published on 2010-05-28T11:20:05Z Indexed on 2010/05/28 11:21 UTC
Read the original article Hit count: 445

I've got a View.xaml with the following set in Resources-section:

<DataTemplate DataType="{x:Type ViewModels:MyFirstViewModel}">
    <Views:MyFirstView Content="{Binding}" />
</DataTemplate>

<DataTemplate DataType="{x:Type ViewModels:MySecondViewModel}">
    <Views:MySecondView Content="{Binding}"/>
</DataTemplate>

In the content of the View.xaml I have:

<!-- SelectedMyViewModel is either set to MyFirstViewModel or MySecondViewModel -->
<ContentControl Content="{Binding SelectedMyViewModel}" />

When the SelectedMyViewModel changes I'd like to have a animation, so that the current view is faded out and the new view is faded in...

Somehow I feel this should be possible via the VisualStateManager - but I can't figure out how!

This is a WPF 4.0 project...

© Stack Overflow or respective owner

Related posts about wpf

Related posts about animation