Time is like water, you can not go back into the flow!
Thumbs up again, a habit, which is that you give me creative power!
This article Dotnet9 https://dotnet9.com already been included, the owners are happy to share dotnet related technologies, such as Winform, WPF, ASP.NET Core, etc., are also related to the desktop C ++ Qt Quick and Qt Widgets, just share their own familiar, own will.
Read Navigation:
- First, look at the effect
- Second, text background
- Third, code implementation
- Fourth, the article reference
- Fifth, the code download
First, look at the effect
Second, text background
On YouTube to see a video, the end of the text there is a link, using the front-end time introduction of open source C # WPF Control Library HandyControl, which uses the picture controls, water ripple controls, drag strip controls.
Third, code implementation
After the webmaster using WPF .Net Core 3.1 works created, create a name for "CustomControlsHandyOrg" solution, we need to add Nuget library: HandyControl.
Code much, first add HandyControl two style files in App.xaml in:
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"
代码确实不多,关键代码也就10行左右
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>
四、文章参考
上面的代码是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
If the harvest, please forward vigorously (thumbs and can recommend it is excellent); as written text is not easy to feel small, welcome to the site Dotnet9 a reward , small thank you; thank you for concern and support for dotnet technology.