2017-11-19 11 views
2

내 ReactiveUI WPF 응용 프로그램에서 ViewModelViewHost을 사용하여 임의의 viewmodel에 대한보기를 표시합니다. 뷰 모델을 변경할 때 컨트롤은 전환으로 뷰를 페이드 인/아웃합니다. 이 애니메이션을 비활성화하고 싶습니다. 전환 속성을 찾았지만 전환을 변경하는 데만 사용할 수 있으며 비활성화하지 않는 것 같습니다.ViewModelViewHost 전환을 비활성화하는 방법

이렇게 할 방법이 있습니까?

답변

2

당신은 0으로 모든 애니메이션의 Duration 속성을 설정 예에 의한 default template for the TransitioningContentControl을 수정할 수 :

<rx:RoutedViewHost 
      Router="{Binding Router, Mode=OneTime}" 
      HorizontalContentAlignment="Stretch" 
      VerticalContentAlignment="Stretch"> 
    <rx:RoutedViewHost.Style> 
     <Style TargetType="rx:TransitioningContentControl"> 
      <Setter Property="Template"> 
       <Setter.Value> 
        <ControlTemplate TargetType="rx:TransitioningContentControl"> 
         <Grid 
         x:Name="PART_Container" 
         VerticalAlignment="{TemplateBinding VerticalAlignment}" 
         HorizontalAlignment="{TemplateBinding HorizontalAlignment}"> 
          <VisualStateManager.VisualStateGroups> 
           <VisualStateGroup x:Name="PresentationStates"> 

            <VisualState x:Name="Normal"> 
             <Storyboard> 
              <ObjectAnimationUsingKeyFrames 
              BeginTime="00:00:00" 
              Storyboard.TargetName="PART_PreviousContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Visibility)"> 
               <DiscreteObjectKeyFrame KeyTime="00:00:00"> 
                <DiscreteObjectKeyFrame.Value> 
                 <Visibility>Collapsed</Visibility> 
                </DiscreteObjectKeyFrame.Value> 
               </DiscreteObjectKeyFrame> 
              </ObjectAnimationUsingKeyFrames> 
             </Storyboard> 
            </VisualState> 

            <VisualState x:Name="FadeTransition_OutIn"> 
             <Storyboard> 
              <DoubleAnimation 
              BeginTime="00:00:00" Duration="00:00:00" 
              Storyboard.TargetName="PART_PreviousContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Opacity)" 
              From="1" To="0"/> 

              <DoubleAnimation 
              BeginTime="00:00:00" Duration="00:00:00" 
              Storyboard.TargetName="PART_CurrentContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Opacity)" 
              From="0" To="1"/> 
             </Storyboard> 
            </VisualState> 

            <VisualState x:Name="FadeDownTransition_OutIn"> 
             <Storyboard> 
              <DoubleAnimation 
              BeginTime="00:00:00" Duration="00:00:00" 
              Storyboard.TargetName="PART_CurrentContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)" 
              From="-30" To="0"/> 

              <DoubleAnimation 
              BeginTime="00:00:00" Duration="00:00:00" 
              Storyboard.TargetName="PART_PreviousContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)" 
              From="0" To="30"/> 

              <DoubleAnimation 
              BeginTime="00:00:00" Duration="00:00:00" 
              Storyboard.TargetName="PART_CurrentContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Opacity)" 
              From="0" To="1"/> 

              <DoubleAnimation 
              BeginTime="00:00:00" Duration="00:00:00" 
              Storyboard.TargetName="PART_PreviousContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Opacity)" 
              From="1" To="0"/> 
             </Storyboard> 
            </VisualState> 

            <!-- SlideLeftTransition --> 
            <VisualState x:Name="SlideLeftTransition_In"> 
             <Storyboard> 
              <DoubleAnimationUsingKeyFrames 
              Storyboard.TargetName="PART_CurrentContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"> 
               <EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90"/> 
               <EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90"/> 
               <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"> 
                <EasingDoubleKeyFrame.EasingFunction> 
                 <CircleEase EasingMode="EaseOut"/> 
                </EasingDoubleKeyFrame.EasingFunction> 
               </EasingDoubleKeyFrame> 
              </DoubleAnimationUsingKeyFrames> 

              <DoubleAnimationUsingKeyFrames 
              Storyboard.TargetName="PART_CurrentContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Opacity)"> 
               <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0"/> 
               <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1"/> 
              </DoubleAnimationUsingKeyFrames> 

              <ObjectAnimationUsingKeyFrames 
              Storyboard.TargetName="PART_PreviousContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Visibility)"> 
               <DiscreteObjectKeyFrame KeyTime="00:00:00"> 
                <DiscreteObjectKeyFrame.Value> 
                 <Visibility>Collapsed</Visibility> 
                </DiscreteObjectKeyFrame.Value> 
               </DiscreteObjectKeyFrame> 
              </ObjectAnimationUsingKeyFrames> 
             </Storyboard> 
            </VisualState> 

            <VisualState x:Name="SlideLeftTransition_Out"> 
             <Storyboard> 
              <DoubleAnimation 
              BeginTime="00:00:00" Duration="00:00:00" 
              Storyboard.TargetName="PART_PreviousContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)" 
              From="0" To="-90"/> 

              <ObjectAnimationUsingKeyFrames 
              Storyboard.TargetName="PART_CurrentContentPresentationSite" 
              Storyboard.TargetProperty="(UIElement.Visibility)"> 
               <DiscreteObjectKeyFrame KeyTime="00:00:00"> 
                <DiscreteObjectKeyFrame.Value> 
                 <Visibility>Collapsed</Visibility> 
                </DiscreteObjectKeyFrame.Value> 
               </DiscreteObjectKeyFrame> 
              </ObjectAnimationUsingKeyFrames> 
             </Storyboard> 
            </VisualState> 
           </VisualStateGroup> 
          </VisualStateManager.VisualStateGroups> 

          <ContentPresenter 
          x:Name="PART_PreviousContentPresentationSite" 
          Content="{x:Null}" 
          ContentTemplate="{TemplateBinding ContentTemplate}" 
          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> 
           <ContentPresenter.RenderTransform> 
            <TransformGroup> 
             <TransformGroup.Children> 
              <ScaleTransform ScaleX="1" ScaleY="1" /> 
              <TranslateTransform X="0" Y="0" /> 
             </TransformGroup.Children> 
            </TransformGroup> 
           </ContentPresenter.RenderTransform> 
          </ContentPresenter> 

          <ContentPresenter 
          x:Name="PART_CurrentContentPresentationSite" 
          Content="{x:Null}" 
          ContentTemplate="{TemplateBinding ContentTemplate}" 
          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> 
           <ContentPresenter.RenderTransform> 
            <TransformGroup> 
             <TransformGroup.Children> 
              <ScaleTransform ScaleX="1" ScaleY="1" /> 
              <TranslateTransform X="0" Y="0" /> 
             </TransformGroup.Children> 
            </TransformGroup> 
           </ContentPresenter.RenderTransform> 
          </ContentPresenter> 
         </Grid> 
        </ControlTemplate> 
       </Setter.Value> 
      </Setter> 
     </Style> 
    </rx:RoutedViewHost.Style> 
</rx:RoutedViewHost> 
+0

작품을 완벽하게, 감사합니다! – Wouter