Class SfToastNotification
Control that provides the toast popup and related static helpers to show and close toasts. Adding this control to a host's XAML ensures the theme and overlay ControlTemplate from Generic.xaml are available.
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.SfToastNotification
Assembly: Syncfusion.SfToastNotification.WPF.dll
Syntax
public class SfToastNotification : Control, IDisposable
Constructors
SfToastNotification()
Initializes a new instance of the SfToastNotification control. Creating this control in XAML ensures the overlay template and themes are loaded for toast rendering.
Declaration
public SfToastNotification()
Properties
EnableGroupView
Gets or sets a value indicating whether toast notifications should be displayed in a grouped view.
When set to true, toasts with the same group are consolidated and displayed within a grouped container.
When set to false, each toast notification is displayed individually without grouping.
Declaration
public static bool EnableGroupView { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
FlowDirection
Gets or sets the FlowDirection applied to every toast rendered by this control. Affects in-app toasts only. Native toasts are rendered by the OS and are not affected.
Declaration
public static FlowDirection FlowDirection { get; set; }
Property Value
| Type |
|---|
| System.Windows.FlowDirection |
GroupContainerHeader
Gets or sets the header text displayed at the top of the grouped notification container.
When set to null or empty, the localized default ("Notifications") is displayed.
Declaration
public static string GroupContainerHeader { get; set; }
Property Value
| Type |
|---|
| System.String |
IsAccessible
Gets or sets a value indicating whether the toast host exposes
its custom UI Automation peer. When false,
OnCreateAutomationPeer() returns the base peer, which
suppresses the new accessibility surface.
Declaration
public bool IsAccessible { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
MaxToastVisibleCount
Defines the maximum number of toast notifications that can be displayed simultaneously. Remaining toasts will be queued.
Declaration
public static int MaxToastVisibleCount { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
Spacing
Gets or sets the vertical spacing between stacked toast notifications. Default value is 8.0 device-independent pixels.
Declaration
public static double Spacing { get; set; }
Property Value
| Type |
|---|
| System.Double |
Methods
Close(String)
Closes the toast with the specified identifier.
Returns true when a toast was found and closed; otherwise false.
Declaration
public static bool Close(string toastId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | toastId | The identifier of the toast to close. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the toast was closed; otherwise false. |
CloseAll()
Closes all currently showing toasts across the application.
Declaration
public static void CloseAll()
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.SfToastNotificationAutomationPeer when
IsAccessible is true; otherwise the base peer
(suppressing the new accessibility surface).
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
| Type |
|---|
| System.Windows.Automation.Peers.AutomationPeer |
OnPreviewKeyDown(KeyEventArgs)
Declaration
protected override void OnPreviewKeyDown(KeyEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Input.KeyEventArgs | e |
Show(DependencyObject, ToastOptions)
Shows a toast using the provided ToastOptions on the specified host.
Declaration
public static void Show(DependencyObject host, ToastOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.DependencyObject | host | The host System.Windows.DependencyObject used to locate the visual tree. |
| ToastOptions | options | Options describing the toast content and behavior. |