- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 ReactiveUI WPF 应用程序中使用 ViewModelViewHost
来显示任意 View 模型的 View 。更改 View 模型时,控件会淡入/淡出 View 作为过渡。我想禁用此动画。我找到了一个 Transition 属性,但它似乎只能用于更改过渡,而不能禁用它。
有什么办法吗?
最佳答案
您可以修改 default template for the TransitioningContentControl例如,将所有动画的 Duration
属性设置为 0:
<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>
关于c# - 如何禁用 ViewModelViewHost 转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47377580/
我在 ReactiveUI WPF 应用程序中使用 ViewModelViewHost 来显示任意 View 模型的 View 。更改 View 模型时,控件会淡入/淡出 View 作为过渡。我想禁用
我正在尝试启动并运行一个新的小型reactUI WPF应用程序。然而 ViewModelViewHost 给我带来了问题。它不会填补寡妇的空缺,但会保持最低限度的要求。 (根据其子项计算) 我的 Ma
我正在尝试启动并运行一个新的小型reactUI WPF应用程序。然而 ViewModelViewHost 给我带来了问题。它不会填补寡妇的空缺,但会保持最低限度的要求。 (根据其子项计算) 我的 Ma
我的应用使用 View ,它实现了 IViewFor界面。这些 View 已在 AppBootstrapper 中的依赖项解析器中注册.该应用程序使用 ViewModelViewHost 显示 Vie
我正在尝试将 ReactiveUI 与 Xamarin Forms 结合使用,但在让 View Model Location 在具有 ItemTemplate 的 ListView 中工作时遇到了一些
在ViewModel是一个 public List OperationModes { get; } = Enum.GetNames(typeof(EOperationMode)).ToList();
在ViewModel是一个 public List OperationModes { get; } = Enum.GetNames(typeof(EOperationMode)).ToList();
我是一名优秀的程序员,十分优秀!