Class ToastItem
Represents a toast instance used by hosts to render a notification. This model is created from ToastOptions and exposes read-only properties used by the control template.
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.SfToastNotification
Assembly: Syncfusion.SfToastNotification.WPF.dll
Syntax
public class ToastItem : ContentControl, IDisposable
Fields
AccentBrushProperty
Declaration
public static readonly DependencyProperty AccentBrushProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
ActionTemplateSelectorProperty
Identifies the ActionTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty ActionTemplateSelectorProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
AutomationIdProperty
Identifies the AutomationId dependency property. When non-null/non-empty, the automation peer reports this value to UI Automation; otherwise the peer falls back to Syncfusion.UI.Xaml.SfToastNotification.ToastItem.Id.
Declaration
public static readonly DependencyProperty AutomationIdProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
AutomationNameProperty
Identifies the AutomationName dependency property. When set and non-empty, the automation peer reports this value verbatim as the UIA Name; otherwise the peer builds the merged "{SeverityWord} {Title}. {Header}. {Message}." string.
Declaration
public static readonly DependencyProperty AutomationNameProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
CloseButtonTemplateProperty
Identifies the CloseButtonTemplate dependency property.
Declaration
public static readonly DependencyProperty CloseButtonTemplateProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
HelpTextProperty
Identifies the HelpText dependency property. Reported to UI Automation as the toast's UIA HelpText.
Declaration
public static readonly DependencyProperty HelpTextProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
IsExpandedProperty
Identifies the IsExpanded dependency property.
Declaration
public static readonly DependencyProperty IsExpandedProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
SeverityProperty
Identifies the Severity dependency property.
Declaration
public static readonly DependencyProperty SeverityProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
TitleTemplateProperty
Identifies the TitleTemplate dependency property.
Declaration
public static readonly DependencyProperty TitleTemplateProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
VariantProperty
Identifies the Variant dependency property.
Declaration
public static readonly DependencyProperty VariantProperty
Field Value
| Type |
|---|
| System.Windows.DependencyProperty |
Properties
AccentBrush
Gets or sets the accent brush used to tint visual elements for this toast (icons, borders, and highlights). Not applied when Severity is None. Applies to in-app toasts only; not used for native toasts.
Declaration
public SolidColorBrush AccentBrush { get; set; }
Property Value
| Type |
|---|
| System.Windows.Media.SolidColorBrush |
Actions
Gets the collection of actions rendered for this toast.
Declaration
public IReadOnlyList<ToastAction> Actions { get; }
Property Value
| Type |
|---|
| System.Collections.Generic.IReadOnlyList<ToastAction> |
ActionTemplateSelector
Gets or sets the System.Windows.Controls.DataTemplateSelector used to choose templates for action buttons. Allows per-action template selection. Applies to in-app toasts only; not used for native toasts.
Declaration
public DataTemplateSelector ActionTemplateSelector { get; set; }
Property Value
| Type |
|---|
| System.Windows.Controls.DataTemplateSelector |
AutomationId
Gets or sets the UI Automation AutomationId for this toast.
Declaration
public string AutomationId { get; set; }
Property Value
| Type |
|---|
| System.String |
AutomationName
Gets or sets the UI Automation Name for this toast, overriding the auto-generated merged name when set and non-empty.
Declaration
public string AutomationName { get; set; }
Property Value
| Type |
|---|
| System.String |
CloseButtonTemplate
Gets or sets the template used to render the close button. Applies to in-app toasts only; not used for native toasts.
Declaration
public DataTemplate CloseButtonTemplate { get; set; }
Property Value
| Type |
|---|
| System.Windows.DataTemplate |
FormattedCreatedTime
Gets the formatted creation time (e.g., "02:31 PM") displayed in grouped toast item rows.
Declaration
public string FormattedCreatedTime { get; }
Property Value
| Type |
|---|
| System.String |
Remarks
This property is intended for use in control templates only. Do not use this in application code.
Header
Gets the header text shown above or beside the message. Applies to in-app toasts only; not used for native toasts.
Declaration
public string Header { get; }
Property Value
| Type |
|---|
| System.String |
HelpText
Gets or sets the UI Automation HelpText for this toast.
Declaration
public string HelpText { get; set; }
Property Value
| Type |
|---|
| System.String |
IsAccessible
Gets or sets a value indicating whether this toast exposes its custom UI Automation peer.
Declaration
public bool IsAccessible { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IsExpanded
Gets or sets a value indicating whether this toast item is expanded (its full content is shown inside a grouped notification container).
Declaration
public bool IsExpanded { get; }
Property Value
| Type |
|---|
| System.Boolean |
ItemCloseCommand
Gets the command that closes (removes) this toast item from its group.
Declaration
public ICommand ItemCloseCommand { get; }
Property Value
| Type |
|---|
| System.Windows.Input.ICommand |
ItemToggleCommand
Gets the command that toggles this item between its collapsed row and full content inside a grouped notification (accordion behavior).
Declaration
public ICommand ItemToggleCommand { get; }
Property Value
| Type |
|---|
| System.Windows.Input.ICommand |
Message
Gets the main message body of the toast.
Declaration
public string Message { get; }
Property Value
| Type |
|---|
| System.String |
Mode
Gets the display mode used for this toast.
Declaration
public ToastMode Mode { get; }
Property Value
| Type |
|---|
| ToastMode |
Severity
Gets or sets the severity for the toast. Applies to in-app toasts only; not used for native toasts. Use the matching SeverityProperty for binding.
Declaration
public ToastSeverity Severity { get; set; }
Property Value
| Type |
|---|
| ToastSeverity |
ShowActionButtons
Gets a value indicating whether the action buttons row should be displayed. Applies to in-app toasts only; not used for native toasts.
Declaration
public bool ShowActionButtons { get; }
Property Value
| Type |
|---|
| System.Boolean |
ShowCloseButton
Gets a value indicating whether the close button should be displayed. Applies to in-app toasts only; not used for native toasts.
Declaration
public bool ShowCloseButton { get; }
Property Value
| Type |
|---|
| System.Boolean |
Title
Gets the title text for the toast.
Declaration
public string Title { get; }
Property Value
| Type |
|---|
| System.String |
TitleTemplate
Gets or sets the template used to render the title area of the toast. Applies to in-app toasts only; not used for native toasts.
Declaration
public DataTemplate TitleTemplate { get; set; }
Property Value
| Type |
|---|
| System.Windows.DataTemplate |
ToastSound
Specifies the sound to be played for a toast notification.
Declaration
public ToastSound ToastSound { get; set; }
Property Value
| Type |
|---|
| ToastSound |
Remarks
This is applicable to both system and in-app toast notifications.
ToastSoundPath
Declaration
public Uri ToastSoundPath { get; set; }
Property Value
| Type |
|---|
| System.Uri |
Variant
Gets or sets the visual variant of the toast (Text, Outlined, Filled). Applies to in-app toasts only; not used for native toasts. Use the matching VariantProperty for binding.
Declaration
public ToastVariant Variant { get; set; }
Property Value
| Type |
|---|
| ToastVariant |
Methods
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
OnCreateAutomationPeer()
Returns a Syncfusion.UI.Xaml.SfToastNotification.ToastItemAutomationPeer when
IsAccessible is true; otherwise the base peer.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
| Type |
|---|
| System.Windows.Automation.Peers.AutomationPeer |