C# toggle visibility in Grid - slow speed
I'm creating interactive slideshow control in wpf/c#. I've want to create something similar to lightbox and coverflow.
I'm using this fading effect: http://www.codeproject.com/Articles/57175/WPF-How-To-Animate-Visibility-Property/?dis开发者_如何转开发play=Mobile
And this code for testing coverflow: http://d3dal3.blogspot.com/2009/04/wpf-cover-flow-tutorial-part-7.html
Everything works ok if I don't many covers in the coverflow... If there is more than 5 is takes > 3 - 4 seconds to start fading animation (animation is ok). But when I fade out this layer and again fade in everything is working perfectly, how ever when I restart app and want to fade in this element I need to wait for animation more than 3, 4 seconds. It seems that WPF need to render(?) this collapsed element and then animation starts... but how can fix this problem?
Here is my code for Window:
<Window>
<Grid>
.
.
.
. other content
<Border x:Name="panelLoading" Visibility="Collapsed" common:VisibilityAnimation.AnimationType="Fade">
<Grid>
<Border Background="Black" Opacity="0.6">
</Border>
<Grid>
<flow:FlowControl x:Name="flow" Margin="0" Width="1000" Height="800"></flow:FlowControl>
</Grid>
</Grid>
</Border>
</Grid></Window>
If I'm understanding your description, my guess is that you're loading all of the images into memory as the window starts up.
You could load up the first image in the main thread, then use a BackgroundWorker to load up the upcoming images.
精彩评论