【1】、安装
首先,确保你的WPF项目已经引入了HandyControl库。你可以通过NuGet包管理器来安装它。在Visual Studio中,你可以通过以下步骤安装HandyControl:
- 打开你的WPF项目。
- 在"解决方案资源管理器"中右键点击你的项目,选择"管理NuGet包"。
- 在NuGet包管理器中搜索"HandyControl"。
- 找到HandyControl,点击安装。
【2】使用 在xmal文件开头添加命名空间:xmlns:hc="https://handyorg.github.io/handycontrol"
1、hc:TransitioningContentControl 控件,用于给里面的控件增加显示效果,类似软件加载时,显示的加载效果动画
cs
<hc:TransitioningContentControl
Grid.Row="0"
TransitionMode="Right2Left"
Margin="6">
</hc:TransitioningContentControl>
2、hc:NumericUpDown
它是专门用来做数字输入的,我最常用到的属性包括他小数位数(DecimatePlaces属性)、最大最小值(Maximum属性Minimum属性)以及获取数值(value属性)
cs
<hc:NumericUpDown Name="numWork" Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="工作时长" Value="50"
Style="{StaticResource NumericUpDownPlus}" hc:InfoElement.Necessary="True" Margin="0,32,0,0"/>