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

時間如流水,只能流去不流回!點贊再看,養(yǎng)成習(xí)慣,這是您給我創(chuàng)作的動力!本文 Dotnet9 https://dotnet9.com 已收錄,站長樂于分享dotnet相關(guān)技術(shù),比如Winform、WPF、ASP.NET Core等,亦有C++桌面相關(guān)的Qt Quick和Qt Widgets等,只分享自己熟悉的、自己會的。

閱讀導(dǎo)航:

一、先看效果

二、本文背景

三、代碼實現(xiàn)

四、文章參考

五、代碼下載

一、先看效果

二、本文背景

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

三、代碼實現(xiàn)

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

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

<Application x:Class="CustomControlsHandyOrg.App"

? ? ? ? ? ? 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 Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>

? ? ? ? ? ? <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>

? ? ? ? </ResourceDictionary.MergedDictionaries>

? ? </ResourceDictionary>

? ? </Application.Resources>

</Application>

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

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

代碼確實不多,關(guān)鍵代碼也就10行左右

<Window x:Class="CustomControlsHandyOrg.MainWindow"

? ? ? ? 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 Background="#FF222222">

? ? ? ? <StackPanel VerticalAlignment="Center">

? ? ? ? ? ? <hc:Gravatar Id="{Binding Value,ElementName=slider}"/>

? ? ? ? ? ? <TextBlock FontSize="18" Text="DOWNLOADING" Margin="5 15" Foreground="White" HorizontalAlignment="Center"/>

? ? ? ? ? ? <hc:WaveProgressBar Value="{Binding Value,ElementName=slider}" Maximum="100" Background="#FF555555" WaveFill="#ff563380" WaveStroke="#FF5675" WaveThickness="1" Foreground="White"/>

? ? ? ? ? ? <Button Content="STOP" Margin="15" HorizontalAlignment="Stretch" Background="#FF563380" BorderBrush="#FF482480" Foreground="White"/>

? ? ? ? ? ? <hc:PreviewSlider x:Name="slider" Maximum="100" Margin="20"/>

? ? ? ? </StackPanel>

? ? </Grid>

</Window>

四、文章參考

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

參考:

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

五、代碼下載

文章中代碼已經(jīng)全部貼出,就這么幾行代碼,不要奇怪,就是這么多。

除非注明,文章均由?Dotnet9?整理發(fā)布,歡迎轉(zhuǎn)載。轉(zhuǎn)載請注明本文地址:https://dotnet9.com/2019/12/it-technology/csharp/wpf/trying-handy-org-custom-controls.html如有所收獲,請大力轉(zhuǎn)發(fā)(能點贊及推薦那是極好的);如覺小編寫文不易,歡迎給Dotnet9站點打賞,小編謝謝了;謝謝大家對dotnet技術(shù)的關(guān)注和支持 。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容