C# WPF有趣的登陸加載窗體

時間如流水,只能流去不流回!html

點贊再看,養成習慣,這是您給我創做的動力!前端

本文 Dotnet9 https://dotnet9.com 已收錄,站長樂於分享dotnet相關技術,好比Winform、WPF、ASP.NET Core等,亦有C++桌面相關的Qt Quick和Qt Widgets等,只分享本身熟悉的、本身會的。git

閱讀導航:github

  • 1、先看效果
  • 2、本文背景
  • 3、代碼實現
  • 4、文章參考
  • 5、代碼下載

1、先看效果

C# WPF有趣的登陸加載窗體

2、本文背景

在YouTube上看到的一個視頻,文末有連接,使用前端時間介紹的開源C# WPF 控件庫HandyControl,用到了其中的頭像控件、水波紋控件、拖動條控件等。express

3、代碼實現

站長使用.Net Core 3.1建立的WPF工程,建立名稱爲「CustomControlsHandyOrg」的解決方案後,須要添加Nuget庫:HandyControl。app

C# WPF有趣的登陸加載窗體

代碼很少,首先在App.xaml中添加HandyControl兩個樣式文件:ide

 1 <Application x:Class="CustomControlsHandyOrg.App"
 2              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4              xmlns:local="clr-namespace:CustomControlsHandyOrg"
 5              StartupUri="MainWindow.xaml">
 6     <Application.Resources>
 7         <ResourceDictionary>
 8             <ResourceDictionary.MergedDictionaries>
 9                 <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
10                 <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
11             </ResourceDictionary.MergedDictionaries>
12         </ResourceDictionary>
13     </Application.Resources>
14 </Application>

另一個代碼文件是MainWindow.xaml,首先引入HandyControl命名空間學習

 1 xmlns:hc="https://handyorg.github.io/handycontrol" ui

代碼確實很少,關鍵代碼也就10行左右spa

 1 <Window x:Class="CustomControlsHandyOrg.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:CustomControlsHandyOrg"
 7         mc:Ignorable="d"
 8         xmlns:hc="https://handyorg.github.io/handycontrol"
 9         Height="450" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None">
10     <Grid Background="#FF222222">
11         <StackPanel VerticalAlignment="Center">
12             <hc:Gravatar Id="{Binding Value,ElementName=slider}"/>
13             <TextBlock FontSize="18" Text="DOWNLOADING" Margin="5 15" Foreground="White" HorizontalAlignment="Center"/>
14             <hc:WaveProgressBar Value="{Binding Value,ElementName=slider}" Maximum="100" Background="#FF555555" WaveFill="#ff563380" WaveStroke="#FF5675" WaveThickness="1" Foreground="White"/>
15             <Button Content="STOP" Margin="15" HorizontalAlignment="Stretch" Background="#FF563380" BorderBrush="#FF482480" Foreground="White"/>
16             <hc:PreviewSlider x:Name="slider" Maximum="100" Margin="20"/>
17         </StackPanel>
18     </Grid>
19 </Window>

4、文章參考

上面的代碼是Dotnet9看 Disign com WPF 大神視頻手敲的,下面是大神youtube地址及本實例學習視頻。

參考:
Design com WPF :  https://www.youtube.com/watch?v=8uW5uY6PvDQ

5、代碼下載

文章中代碼已經所有貼出,就這麼幾行代碼,不要奇怪,就是這麼多。

除非註明,文章均由 Dotnet9 整理髮布,歡迎轉載。

轉載請註明本文地址:https://dotnet9.com/2019/12/it-technology/csharp/wpf/trying-handy-org-custom-controls.html

若有所收穫,請大力轉發(能點贊及推薦那是極好的);如覺小編寫文不易,歡迎給Dotnet9站點打賞,小編謝謝了;謝謝你們對dotnet技術的關注和支持 。

相關文章
相關標籤/搜索