2

Windows RT用のアプリケーションを設計しています。私はユーザーコントロールVisualStateManagerのスナップに使用しました。しかし、私のアプリケーションがスナップされたとき、ユーザー コントロールは変更されません。問題はどこだ?

<Grid  Width="500" Height="40" Margin="15" x:Name="questionRoot" Background="DarkSeaGreen">

    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >

        <TextBlock x:Name="OrginalWord" FontSize="32" Text="{Binding Question.OrginalWord}"></TextBlock>

    </StackPanel>
    <VisualStateManager.VisualStateGroups>

        <!-- Visual states reflect the application's view state -->
        <VisualStateGroup x:Name="ApplicationViewStates">
            <VisualState x:Name="FullScreenLandscape"/>
            <VisualState x:Name="Filled"/>

            <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
            <VisualState x:Name="FullScreenPortrait"/>
            <!--
                The back button and title have different styles when snapped, and the list representation is substituted
                for the grid displayed in all other view states
            -->
            <VisualState x:Name="Snapped">
                <Storyboard>

                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OrginalWord" Storyboard.TargetProperty="FontSize">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="88"/>
                    </ObjectAnimationUsingKeyFrames>



                </Storyboard>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
</Grid>

4

2 に答える 2

1

VisualStateManager.GoToStateコードビハインドでメソッドを呼び出していますか? アプリケーションが Full/Fill モードから Snap モードに移行するタイミングを検出し、次にこのメソッドを呼び出す必要があります。

この関数に関する MSDN ドキュメントは、こちら にあります

Page通常、親コントロールまたはアプリケーションのサイズが変更されると、この遷移が認識されますWindowこの SO の質問(Jowen の回答を参照) は、ウィンドウのサイズ変更イベントをリッスンしてこれを行う方法のコード スニペットを提供します。

于 2012-12-05T07:33:25.587 に答える