NotificationContent 类
- 程序集
- ClassIsland.Core.dll
代表一个提醒中的一部分内容。
public class NotificationContent : ObservableRecipient, INotifyPropertyChanged, INotifyPropertyChanging
- 继承
-
NotificationContent
- 实现
- 继承成员
构造函数
NotificationContent()
初始化一个 NotificationContent 对象
public NotificationContent()
NotificationContent(object?)
初始化一个 NotificationContent 对象
public NotificationContent(object? content)
参数
contentobject提醒内容对象
字段
Empty
代表空内容
public static readonly NotificationContent Empty
字段值
属性
Color
此部分的涟漪特效颜色。
public IBrush? Color { get; set; }
属性值
- IBrush
Content
提醒内容。
public object? Content { get; set; }
属性值
ContentTemplate
提醒内容模板,可选。如果此值不为 null,将在呈现提醒内容 Content 时使用。
public DataTemplate? ContentTemplate { get; set; }
属性值
- DataTemplate
备注
即使不设置此属性,ContentPresenter 也会根据设置的数据类型选择资源中对应的数据模板进行呈现。
ContentTemplateResourceKey
提醒内容模板资源键,可选。如果此值不为 null,将在呈现提醒内容 Content 时使用。
public object? ContentTemplateResourceKey { get; set; }
属性值
备注
即使不设置此属性,ContentPresenter 也会根据设置的数据类型选择资源中对应的数据模板进行呈现。设置此属性后,将覆盖在 ContentTemplate 上设置的值。
Duration
此部分的显示时长。当 EndTime 不为 null 时,此项不起作用。
public TimeSpan Duration { get; set; }
属性值
EndTime
此部分显示的结束时间。
public DateTime? EndTime { get; set; }
属性值
IsSpeechEnabled
显示此部分的提醒时是否启用语音。
public bool IsSpeechEnabled { get; set; }
属性值
SpeechContent
显示此部分提醒时的语音内容。
public string SpeechContent { get; set; }
属性值
方法
CreateRollingTextContent(string, TimeSpan?, int, Action<NotificationContent>?)
从模板创建滚动文本内容。
public static NotificationContent CreateRollingTextContent(string text, TimeSpan? duration = null, int repeatCount = 2, Action<NotificationContent>? factory = null)
参数
textstring文本
durationTimeSpan?提醒显示时长
repeatCountint滚动重复次数
factoryAction<NotificationContent>提醒内容处理工厂
返回
CreateSimpleTextContent(string, Action<NotificationContent>?)
从模板创建简单文本内容。
public static NotificationContent CreateSimpleTextContent(string text, Action<NotificationContent>? factory = null)
参数
textstring文本
factoryAction<NotificationContent>提醒内容处理工厂
返回
CreateTwoIconsMask(string, string, string, bool, Action<NotificationContent>?)
从模板创建双图标提醒遮罩内容。
public static NotificationContent CreateTwoIconsMask(string text, string leftIcon = "lucide()", string rightIcon = "lucide()", bool hasRightIcon = true, Action<NotificationContent>? factory = null)
参数
textstring遮罩文本
leftIconstring左侧图标
rightIconstring右侧图标
hasRightIconbool是否拥有右侧图标
factoryAction<NotificationContent>提醒内容处理工厂