VisualStateManager가 작동하지 않는 이유는 무엇입니까?

MarvelTitle
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
   <Grid>
       <Grid.ColumnDefinitions>
           <ColumnDefinition Width="auto"/>
           <ColumnDefinition Width="*"/>
           <ColumnDefinition Width="auto"/>`enter code here`
       </Grid.ColumnDefinitions>
       <VisualStateManager.VisualStateGroups>
           <VisualStateGroup>
               <VisualState x:Name="Narrow">
                   <VisualState.StateTriggers>
                       <AdaptiveTrigger MinWindowWidth="0"/>
                   </VisualState.StateTriggers>
                   <VisualState.Setters>
                       <Setter Target="SliderProgress.Visibility" Value="Collasped"/>
                       <Setter Target="TimeProgress.Visibility" Value="Visible"/>
                       <Setter Target="btnPlayList.Visibility" Value="Collasped"/>
                   </VisualState.Setters>
               </VisualState>
               <VisualState x:Name="Wide">
                   <VisualState.StateTriggers>
                       <AdaptiveTrigger MinWindowWidth="600"/>
                   </VisualState.StateTriggers>
                   <VisualState.Setters>
                       <Setter Target="SliderProgress.Visibility" Value="Visible"/>
                       <Setter Target="TimeProgress.Visibility" Value="Collapsed"/>
                       <Setter Target="btnPlayList.Visibility" Value="Visible"/>
                   </VisualState.Setters>
               </VisualState>
           </VisualStateGroup>
       </VisualStateManager.VisualStateGroups>
       <Image Grid.Column="0" 
              Height="70" 
              Width="70"/>
       <!--PlayProgress-->
       <StackPanel Grid.Column="1"
                   Margin="10,0,0,0">
           <TextBlock Text="Title"/>
           <Slider Name="SliderProgress"
                   Visibility="Collapsed"/>
           <StackPanel Orientation="Horizontal"
                       Margin="10,10,0,0"
                       Name="TimeProgress"
                       Visibility="Visible">
               <TextBlock Name="CurrentTime"
                          Text="CurrentTime"/>
               <TextBlock Text=" / "/>
               <TextBlock Name="TotleTime"
                          Text="TotleTime"/>
           </StackPanel>
       </StackPanel>
       <!--PlayProgress Over-->
       <!--PlayControlButton-->
       <StackPanel Grid.Column="2" 
                   Orientation="Horizontal"
                   Grid.ColumnSpan="1">
           <Button Style="{StaticResource CtrlButton}"
                   Content="&#xE0E2;">
           </Button>
           <Button Style="{StaticResource CtrlButton}"
                   Content="&#xE102;">
           </Button>
           <Button Style="{StaticResource CtrlButton}"
                   Content="&#xE0E3;">
           </Button>
           <Button Name="btnPlayList"
                   Style="{StaticResource CtrlButton}"
                   Content="&#xE142;"
                   Visibility="Collapsed">
           </Button>
       </StackPanel>
       <!--PlayControlButton Over-->
   </Grid>

VisualStateManager가 작동하지 않는 이유를 이해하도록 도와주세요. 정말 문제가됩니다. 두 번째 Grid를 제거하면 XAML 디자이너에 오류가 표시되고 앱을 실행하면 SliderProgress 및 TimeProgress 숨기기가 표시됩니다.

제이 주오

코드에 두 가지 문제가 있습니다.

첫째, VisualStateManager.VisualStateGroups연결된 속성은 Page 의 루트 요소 아래에 있어야합니다 . 따라서 다음 과 같이 VisualStateManager루트 아래에 둘 수 있습니다 Gird.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup>
            <VisualState x:Name="Narrow">
                ...
            </VisualState>
            <VisualState x:Name="Wide">
                ...
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <Grid>
        ...
    </Grid>
</Grid>

둘째의 속성 값 유형 가시성 이다 가시성 열거. 열거 형 값에 애니메이션을 적용하려면 DiscreteObjectKeyFrame을 사용해야합니다 . (부울 값에도이 기술을 사용합니다.)

따라서 다음과 같이 코드를 변경할 수 있습니다. 그럼 당신 VisualStateManager은 일할 수 있어야합니다.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup>
            <VisualState x:Name="Narrow">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="0" />
                </VisualState.StateTriggers>
                <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="SliderProgress" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="TimeProgress" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="btnPlayList" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </VisualState>
            <VisualState x:Name="Wide">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="600" />
                </VisualState.StateTriggers>
                <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="SliderProgress" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="TimeProgress" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="btnPlayList" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <Grid>
        ...
    </Grid>
</Grid>

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

VisualStateManager가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

sed가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

indexOf가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

.hover ()가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

CSSArrowPlease가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

setuid가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

pip가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

'DefaultAxesMarkerOrder'가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

free ()가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

REGEX가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

setOnItemLongClickListener가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

removeClass가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

Angularjs가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

isEOF가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

isdigit ()가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

ActionListener가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

GCC가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

NSMutableArray가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

paintComponent가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

LocalBroadcastManager가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

LocalBroadcastManager가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

getScaledInstance ()가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

JavaScript가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

startActivityForResult가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

swappiness가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

var =-가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

isElementPresent가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

"this"가 작동하지 않는 이유는 무엇입니까?

분류에서Dev

appendChild가 작동하지 않는 이유는 무엇입니까?

Related 관련 기사

  1. 1

    VisualStateManager가 작동하지 않는 이유는 무엇입니까?

  2. 2

    sed가 작동하지 않는 이유는 무엇입니까?

  3. 3

    indexOf가 작동하지 않는 이유는 무엇입니까?

  4. 4

    .hover ()가 작동하지 않는 이유는 무엇입니까?

  5. 5

    CSSArrowPlease가 작동하지 않는 이유는 무엇입니까?

  6. 6

    setuid가 작동하지 않는 이유는 무엇입니까?

  7. 7

    pip가 작동하지 않는 이유는 무엇입니까?

  8. 8

    'DefaultAxesMarkerOrder'가 작동하지 않는 이유는 무엇입니까?

  9. 9

    free ()가 작동하지 않는 이유는 무엇입니까?

  10. 10

    REGEX가 작동하지 않는 이유는 무엇입니까?

  11. 11

    setOnItemLongClickListener가 작동하지 않는 이유는 무엇입니까?

  12. 12

    removeClass가 작동하지 않는 이유는 무엇입니까?

  13. 13

    Angularjs가 작동하지 않는 이유는 무엇입니까?

  14. 14

    isEOF가 작동하지 않는 이유는 무엇입니까?

  15. 15

    isdigit ()가 작동하지 않는 이유는 무엇입니까?

  16. 16

    ActionListener가 작동하지 않는 이유는 무엇입니까?

  17. 17

    GCC가 작동하지 않는 이유는 무엇입니까?

  18. 18

    NSMutableArray가 작동하지 않는 이유는 무엇입니까?

  19. 19

    paintComponent가 작동하지 않는 이유는 무엇입니까?

  20. 20

    LocalBroadcastManager가 작동하지 않는 이유는 무엇입니까?

  21. 21

    LocalBroadcastManager가 작동하지 않는 이유는 무엇입니까?

  22. 22

    getScaledInstance ()가 작동하지 않는 이유는 무엇입니까?

  23. 23

    JavaScript가 작동하지 않는 이유는 무엇입니까?

  24. 24

    startActivityForResult가 작동하지 않는 이유는 무엇입니까?

  25. 25

    swappiness가 작동하지 않는 이유는 무엇입니까?

  26. 26

    var =-가 작동하지 않는 이유는 무엇입니까?

  27. 27

    isElementPresent가 작동하지 않는 이유는 무엇입니까?

  28. 28

    "this"가 작동하지 않는 이유는 무엇입니까?

  29. 29

    appendChild가 작동하지 않는 이유는 무엇입니까?

뜨겁다태그

보관