Hi all!
Im developing wpf application where mainwindow presents one view (view = UserControl) at the time. Moving between views launches storyboard where old view is replaced new one with slide effect. Views dimension are 1024 x 768 and transiton takes about 0,5 seconds.
So far I have been developing my application with "dummy" views which is basically usercontrol with image background and thats it. Transitions works smoothly.
Recently I have been developing my views, adding real ui components like buttons, comboboxes and custom usercontrols on it and codebehind code and now I faced real problem. My transition are laggy and not smooth at all!
So is there any tips to increase my transition performance? maybe disabling / changing my usercontrol state while in transition?
UPDATE:
I'll add some code to show basic idea to easilly reproduce example application. Just create new wpf application " TransitionTest"
MainWindow.xaml
<Window x:Class="TransitionTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="768" Width="1024">
<Window.Resources>
<Storyboard x:Key="SlideIn" >
<ThicknessAnimation Duration="0:0:0.5" Storyboard.TargetProperty="Margin" From="1024,0,0,0" To="0" DecelerationRatio="1" />
</Storyboard>
</Window.Resources>
<Grid x:Name="mainView">
<ContentPresenter x:Name="contentPresenter" Grid.Row="0"> </ContentPresenter>
<Button Height="30" VerticalAlignment="Bottom" Content="Load UserControl" Click="LoadUserControl_Click"></Button>
</Grid>
</Window>
and event handler for button in MainWindow.cs
private void LoadUserControl_Click(object sender, RoutedEventArgs e)
{
UserControl View = new UserControl();
View.Background = Brushes.Green;
contentPresenter.Content = View;
Storyboard showNewPage = Resources["SlideIn"] as Storyboard;
showNewPage.Begin(contentPresenter);
}
Hope you got idea :)
Appreciate your thoughts!
Cheers!