前言:HandyControl是一个前端ui框架,包含了一些常用的控件,现记录下使用情况,如有不对的地方,请多多指教
第一步:NuGet安装
网上有版本说需要添加下面两个,导航到github发现,HandyControl更新维护好像更及时一点,然后HandyControls的github上面有一段话说是面向中国,其实只要导入HandyControl包就可以了。
HandyControl 和 HandyControls 注意有些版本可能已经不支持了,选最新的就可以了,也不要在意两个库版本不对应了
第二步:readme.txt
安装完后会弹出来一个readme.txt,根据提示,在App.xaml 的Application.Resources中引用 HandyControl相关资源
<Application x:Class="WpfHandyControl.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfHandyControl"
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>
一个是皮肤资源,一个是主题资源
第三步:引用命名空间
在需要使用的页面中引用命名空间,引入命名空间后,可以将最外层的Window标签替换成HandyControl空间下的窗体。
还需要修改下对应的后台代码
第四步:简单使用
借用下源码中的Listbox控件测试下,效果还是可以的