自学内容网 自学内容网

wpf 保姆级教学 制作丝滑浮动菜单(缩放按键)(基于MahApps)

请添加图片描述

<mah:MetroWindow x:Class="MyControlsTest.ToolBoxView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:MyControlsTest"
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
        mc:Ignorable="d"
        xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
        Title="MainWindow" SizeToContent="WidthAndHeight" 
        Background="Transparent" 
        UseNoneWindowStyle="True" 
        AllowsTransparency="True"
        BorderThickness="0" PreviewMouseDown="MetroWindow_PreviewMouseDown" PreviewMouseMove="MetroWindow_PreviewMouseMove" PreviewMouseLeftButtonUp="MetroWindow_PreviewMouseLeftButtonUp" WindowStartupLocation="CenterScreen">

    <mah:MetroWindow.Resources>
        <Storyboard x:Key="ExpandStoryboard">
            <DoubleAnimation
                                Storyboard.TargetName="CtrlGrid"
                                Storyboard.TargetProperty="Width"
                                From="0"
                                To="100"
                                Duration="0:0:0.2"
                                />
        </Storyboard>

        <Storyboard x:Key="CollapseStoryboard">
            <DoubleAnimation
                                Storyboard.TargetName="CtrlGrid"
                                Storyboard.TargetProperty="Width"
                                From="100"
                                To="0"
                                Duration="0:0:0.2"
                                 />
        </Storyboard>

    </mah:MetroWindow.Resources>

    <Grid  Background="Transparent">
        <Grid.ColumnDefinitions>
            <ColumnDefinition  Width="auto"></ColumnDefinition>
            <ColumnDefinition  Width=

原文地址:https://blog.csdn.net/weixin_44291381/article/details/143499461

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!