189 8069 5689

C#中怎么利用WPF自定义菜单切换动画

本篇文章给大家分享的是有关C# 中怎么利用WPF自定义菜单切换动画,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

创新互联公司10多年成都定制网站服务;为您提供网站建设,网站制作,网页设计及高端网站定制服务,成都定制网站及推广,对阳光房等多个方面拥有多年的网站制作经验的网站建设公司。

 添加Nuget库

使用 .Net Core 3.1 创建名为“CustomMenu”的WPF解决方案,添加两个Nuget库:MaterialDesignThemes和MaterialDesignColors。

C# 中怎么利用WPF自定义菜单切换动画  
MaterialDesign控件库 

3.2 工程结构

只修改了App.xaml(添加MD控件样式)和MainWindow.xaml(主窗口实现效果)。

3.3 App.xaml引入MD控件样式

            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:local="clr-namespace:CustomMenu"
            StartupUri="MainWindow.xaml">
   
       
           
               
               
           

           
           
           
           
           
           
           
           
           
           
       

   


3.4 主窗体 MainWindow.xaml

添加菜单、设置菜单项切换动画等:

       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:CustomMenu"
       xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
       mc:Ignorable="d"
       Title="MainWindow" Height="600" Width="1080" Background="#FF292929" ResizeMode="NoResize" WindowStyle="None"
       WindowStartupLocation="CenterScreen">

   
       
                                                     Storyboard.TargetName="ellipse">
               
                   
                       
                   

               

           

       


       
                                                     Storyboard.TargetName="ellipse">
               
                   
                       
                   

               

           

       


       
                                                     Storyboard.TargetName="ellipse">
               
                   
                       
                   

               

           

       

   


   
       
           
       

       
           
       

       
           
       

   

   
   
       
           
           
       

       
           
               
               
           

       


       
           
               
               
           


           
               
               
               
           


           
               
                                       RenderTransformOrigin="0.5 0.5">
                   
                       
                           
                           
                           
                           
                       

                   

               

           

       

   

以上就是C# 中怎么利用WPF自定义菜单切换动画,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


当前题目:C#中怎么利用WPF自定义菜单切换动画
URL分享:http://cdxtjz.cn/article/jspgpg.html

其他资讯