In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to use WPF to achieve a drawer effect in C#. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Code implementation
The webmaster uses the WPF project created by .net Core 3.1. after creating the PopUpAndNav solution, you need to add two Nuget libraries: MaterialDesignThemes and MaterialDesignColors.
Add two libraries of Material
The project is relatively simple, mainly the demonstration window MainWindow:
Solution structure
There is not much code, so I will paste it all.
Add MaterialDesignInXaml style: App.xaml
Demo window MainWindow.xaml code, use a simple custom window, see the effect picture, have the title bar menu in the upper right corner and the drawer menu in the upper left corner:
Background MainWindow.xaml.cs, mainly dealing with form closing events and the expansion and folding of drawer menus:
Using System
Using System.Collections.Generic
Using System.Linq
Using System.Text
Using System.Threading.Tasks
Using System.Windows
Using System.Windows.Controls
Using System.Windows.Data
Using System.Windows.Documents
Using System.Windows.Input
Using System.Windows.Media
Using System.Windows.Media.Imaging
Using System.Windows.Navigation
Using System.Windows.Shapes
Namespace PopUpAndNav
{
/ / /
/ Interaction logic for MainWindow.xaml
/ / /
Public partial class MainWindow: Window
{
Public MainWindow ()
{
InitializeComponent ()
}
Private void ButtonPopUpLogout_Click (object sender, RoutedEventArgs e)
{
Application.Current.Shutdown ()
}
Private void ButtonOpenMenu_Click (object sender, RoutedEventArgs e)
{
ButtonOpenMenu.Visibility = Visibility.Collapsed
ButtonCloseMenu.Visibility = Visibility.Visible
}
Private void ButtonCloseMenu_Click (object sender, RoutedEventArgs e)
{
ButtonOpenMenu.Visibility = Visibility.Visible
ButtonCloseMenu.Visibility = Visibility.Collapsed
}
Private void GridTitle_MouseDown (object sender, MouseButtonEventArgs e)
{
DragMove ()
}
}
} on how to use WPF in C# to achieve a drawer effect is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.