Material 设计 (WPF):禁用复选框动画

Material Design (WPF): Disable CheckBox Animation

如何禁用 MaterialDesignInXAML 中的 circle/ripple 复选框动画?

我尝试了以下设置但没有成功:

md:RippleAssist.IsDisabled="True"
md:RippleAssist.Feedback="Transparent"
md:TransitionAssist.DisableTransitions="True"

假设您喜欢其中的所有其他功能,我认为您将需要重新模板。

如果您在此处查看 materialdesigninxaml 的源代码:

https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.CheckBox.xaml

(这是巨大的,否则我会把它全部粘贴在这里。)

您会注意到有一个名为“InteractionEllipse”的椭圆。您可以复制模板并将其撕掉。

                            <Ellipse x:Name="InteractionEllipse" Fill="{TemplateBinding Foreground}" Width="0" Height="0" Canvas.Top="12" Canvas.Left="12" Opacity="0" RenderTransformOrigin="0.5,0.5"
                                     IsHitTestVisible="False">
                                <Ellipse.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Ellipse.RenderTransform>
                            </Ellipse>

还有一个点击调用的情节提要,您将需要修改。或者也许只是删除。

                    <Storyboard x:Key="Click">
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="InteractionEllipse">
                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="InteractionEllipse">
                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="InteractionEllipse">
                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="InteractionEllipse">
                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InteractionEllipse">
                            <EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>

然后在您选择的复选框上使用您的新模板,或者从您在 material 设计内容后合并的资源字典中用您自己的版本“改写”它们的版本。

或者。

您或许可以使用不同的画笔进行填充。您可以添加附加的依赖项 属性 或动态资源。这样您就可以为部分或全部复选框选择透明,我认为它会消失。

它模板绑定到前台

  Fill="{TemplateBinding Foreground}