在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
阅读导航:
一、先看效果二、本文背景无。 三、代码实现站长使用.Net Core 3.1创建的WPF工程,创建名称为“Register”的解决方案后,需要添加Nuget库,下面两个库都需要添加: App.xaml添加MaterialDesign的样式文件 1 <Application.Resources> 2 <ResourceDictionary> 3 <ResourceDictionary.MergedDictionaries> 4 <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/> 5 <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/> 6 <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Purple.xaml"/> 7 <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml"/> 8 </ResourceDictionary.MergedDictionaries> 9 </ResourceDictionary> 10 </Application.Resources> 注册窗体MainWindow.xaml 1 <Window x:Class="Register.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 5 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 6 xmlns:local="clr-namespace:Register" 7 xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 8 mc:Ignorable="d" 9 Title="MainWindow" Height="600" Width="1000"> 10 <Grid Background="#FFDADADA"> 11 <Border Margin="15" MaxWidth="600" Background="White" VerticalAlignment="Center" Padding="30" CornerRadius="15"> 12 <Border.Effect> 13 <DropShadowEffect BlurRadius="30" Color="LightGray" ShadowDepth="0"/> 14 </Border.Effect> 15 <StackPanel> 16 <TextBlock Text="欢迎" FontSize="30" FontWeight="Bold" Margin="0 0 0 20"/> 17 18 <Grid Margin="0 0 0 20"> 19 <Button Content="注册" HorizontalAlignment="Left"/> 20 <Button Content="登录" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}"/> 21 </Grid> 22 23 <TextBox materialDesign:HintAssist.Hint="用户名" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="0 5"/> 24 <PasswordBox materialDesign:HintAssist.Hint="密码" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" Margin="0 5"/> 25 <PasswordBox materialDesign:HintAssist.Hint="确认密码" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" Margin="0 5"/> 26 <TextBox materialDesign:HintAssist.Hint="电子邮件" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="0 5"/> 27 <Button Content="注册" Margin="0 20"/> 28 </StackPanel> 29 </Border> 30 </Grid> 31 </Window> 四、文章参考参考: 五、代码下载文章中代码已经全部贴出,就这么几行代码,不要奇怪,就是这么多。
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论