MVVM with animations (should I use VisualStateManager?)
- by kennethkryger
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...