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

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

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

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

閱讀導航:

  • 一、先看效果
  • 二、本文背景
  • 三、代碼實現
  • 四、文章參考
  • 五、代碼下載

一、先看效果

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

二、本文背景

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

三、代碼實現

站長使用.Net Core 3.1創建的WPF工程,創建名稱為“CustomControlsHandyOrg”的解決方案後,需要添加Nuget庫:HandyControl。

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

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

<code><application>             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CustomControlsHandyOrg"
StartupUri="MainWindow.xaml">
<application.resources>
<resourcedictionary>
<resourcedictionary.mergeddictionaries>
<resourcedictionary>
<resourcedictionary>
/<resourcedictionary.mergeddictionaries>
/<resourcedictionary>
/<application.resources>
/<application>/<code>

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

<code>xmlns:hc="https://handyorg.github.io/handycontrol"/<code>

代碼確實不多,關鍵代碼也就10行左右

<code><window>        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:CustomControlsHandyOrg"
mc:Ignorable="d"
xmlns:hc="https://handyorg.github.io/handycontrol"
Height="450" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None">
<grid>
<stackpanel>
<gravatar>
<textblock>
<waveprogressbar>
<button>
<previewslider>
/<stackpanel>
/<grid>
/<window>/<code>

四、文章參考

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

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

五、代碼下載

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

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

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

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


分享到:


相關文章: