做网站通常又什么开发完成,wordpress禁止评论,规划设计网站推荐,上海软件培训网站建设一、目的#xff1a;在开发过程中#xff0c;增加一些提示消息可以很好的提高用户体验#xff0c;下面介绍一个用于增加提示消息的库 二、效果如下 可以看到右侧顶端弹出提示消息#xff0c;消息间隔3s自动退出
三、环境 VS2022 Net7
四、使用方式
安装nuget包#xff…一、目的在开发过程中增加一些提示消息可以很好的提高用户体验下面介绍一个用于增加提示消息的库 二、效果如下 可以看到右侧顶端弹出提示消息消息间隔3s自动退出
三、环境 VS2022 Net7
四、使用方式
安装nuget包H.Modules.Messages.Dialog和H.Modules.Messages.Notice 添加如下代码 private NoticeMessageService _noticeMessageService new NoticeMessageService();public RelayCommand ShowInfoNoticeCommand new RelayCommand(async (s, e) {_noticeMessageService.ShowInfo(提示信息);});
注v1.0.1中NoticeMessageService需要用单例来显示
后面版本采用 NoticeDialog.ShowInfo(string message)
更多扩展成功提示错误提示警告提示严重错误提示进度提示字符串进度提示对话框提示效果如下 也可以自定义提示消息
首先自定义一个类继承INoticeItem接口 public class MyNotice : INoticeItem{public string Message { get; set; }public string Time { get; }}
然后定义一下MyNotice的DataTemplate Application.ResourcesDataTemplate DataType{x:Type local:MyNotice}BorderHeight50Margin5Padding10,6Background{x:Static SystemColors.ControlBrush}CornerRadius2Grid VerticalAlignmentCenterGrid.ColumnDefinitionsColumnDefinition /ColumnDefinition /ColumnDefinition //Grid.ColumnDefinitionsTextBlock Grid.Column0 Text请输入姓名 /TextBoxGrid.Column1MinWidth120Text{Binding Message} /ButtonGrid.Column3Command{h:DeleteCommand}CommandParameter{Binding RelativeSource{RelativeSource ModeSelf}}Content确定 //Grid/Border/DataTemplate/Application.Resources 如上是定义了一个输入姓名的自定义模板运行效果如下 五、需要了解的知识点
System.Windows.Controls 命名空间 | Microsoft Learn
六、源码地址
GitHub - HeBianGu/WPF-ControlDemo: 示例
GitHub - HeBianGu/WPF-ControlBase: Wpf封装的自定义控件资源库
GitHub - HeBianGu/WPF-Control: WPF轻量控件和皮肤库
七、了解更多
System.Windows.Controls 命名空间 | Microsoft Learn
https://github.com/HeBianGu
HeBianGu的个人空间-HeBianGu个人主页-哔哩哔哩视频