質問

MVVMパターンにはWPFアプリケーションがあります。メインビューでは、他のビューへのリンクがほとんどありません。 しかし、メインビューで内容(つまり、リンク)を表示する前に、メインビューに画像を表示する必要があります。2秒間...そして実際の内容を表示します。

誰もが私を助けますか?

役に立ちましたか?

他のヒント

href="http://msdn.microsoft.com/en-us/library/system.windows.splashscreen.aspx" REL="nofollow noreferrer"> MSDN のSplashScreenクラスの記事 どのようにする方法:スプラッシュスクリーンをWPFアプリケーションに追加する

Since you say that you want the image to be displayed in a window instead of a "classic" splash screen, let me add a second answer: In your WPF window, do something like this:

<Window ...>
    <Window.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="mySplash" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="{x:Static Visibility.Hidden}" />
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="myContent" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Hidden}" />
                        <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="{x:Static Visibility.Visible}" />
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Window.Triggers>
    <Grid>
        <Image x:Name="mySplash" ... />
        <Grid x:Name="myContent">
            ...
        </Grid>
    </Grid>
</Window>

This will show your Image for two seconds, then hide it and show the contents of your myContent grid. If you want to have a nice fade from the splash image to the content, you can animate the Opacity property (using a DoubleAnimation) instead of the Visibility property.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top