Table of Contents

Class Snackbar

Namespace
Wpf.Ui.Controls
Assembly
Wpf.Ui.dll

Snackbar inform user of a process that an app has performed or will perform. It appears temporarily, towards the bottom of the window.

public class Snackbar : ContentControl, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, IAppearanceControl, IIconControl
Inheritance
Snackbar
Implements
Inherited Members

Constructors

Snackbar(SnackbarPresenter)

Initializes a new instance of the Snackbar class with a specified presenter.

public Snackbar(SnackbarPresenter presenter)

Parameters

presenter SnackbarPresenter

The SnackbarPresenter to manage the snackbar's display and interactions.

Fields

AppearanceProperty

Identifies the Appearance dependency property.

public static readonly DependencyProperty AppearanceProperty

Field Value

DependencyProperty

ClosedEvent

Identifies the Closed routed event.

public static readonly RoutedEvent ClosedEvent

Field Value

RoutedEvent

ContentForegroundProperty

Identifies the ContentForeground dependency property.

public static readonly DependencyProperty ContentForegroundProperty

Field Value

DependencyProperty

IconProperty

Identifies the Icon dependency property.

public static readonly DependencyProperty IconProperty

Field Value

DependencyProperty

IsCloseButtonEnabledProperty

Identifies the IsCloseButtonEnabled dependency property.

public static readonly DependencyProperty IsCloseButtonEnabledProperty

Field Value

DependencyProperty

IsShownProperty

Identifies the IsShown dependency property.

public static readonly DependencyProperty IsShownProperty

Field Value

DependencyProperty

OpenedEvent

Identifies the Opened routed event.

public static readonly RoutedEvent OpenedEvent

Field Value

RoutedEvent

SlideTransformProperty

Identifies the SlideTransform dependency property.

public static readonly DependencyProperty SlideTransformProperty

Field Value

DependencyProperty

TemplateButtonCommandProperty

Identifies the TemplateButtonCommand dependency property.

public static readonly DependencyProperty TemplateButtonCommandProperty

Field Value

DependencyProperty

TimeoutProperty

Identifies the Timeout dependency property.

public static readonly DependencyProperty TimeoutProperty

Field Value

DependencyProperty

TitleProperty

Identifies the Title dependency property.

public static readonly DependencyProperty TitleProperty

Field Value

DependencyProperty

TitleTemplateProperty

Identifies the TitleTemplate dependency property.

public static readonly DependencyProperty TitleTemplateProperty

Field Value

DependencyProperty

Properties

Appearance

Gets or sets the Appearance of the control, if available.

[Bindable(true)]
public ControlAppearance Appearance { get; set; }

Property Value

ControlAppearance

ContentForeground

Gets or sets the foreground of the Content.

[Bindable(true)]
public Brush ContentForeground { get; set; }

Property Value

Brush

Icon

Gets or sets the icon

[Bindable(true)]
public IconElement? Icon { get; set; }

Property Value

IconElement

IsCloseButtonEnabled

Gets or sets a value indicating whether the Snackbar close button should be visible.

public bool IsCloseButtonEnabled { get; set; }

Property Value

bool

IsShown

Gets or sets a value indicating whether the Snackbar is visible.

public bool IsShown { get; set; }

Property Value

bool

Presenter

protected SnackbarPresenter Presenter { get; }

Property Value

SnackbarPresenter

SlideTransform

Gets or sets the transform.

public TranslateTransform? SlideTransform { get; set; }

Property Value

TranslateTransform

TemplateButtonCommand

Gets the command triggered after clicking the button in the template.

public IRelayCommand TemplateButtonCommand { get; }

Property Value

IRelayCommand

Timeout

Gets or sets a time for which the Snackbar should be visible.

public TimeSpan Timeout { get; set; }

Property Value

TimeSpan

Title

Gets or sets the title of the Snackbar.

public object? Title { get; set; }

Property Value

object

TitleTemplate

Gets or sets the title template of the Snackbar.

public DataTemplate? TitleTemplate { get; set; }

Property Value

DataTemplate

Methods

Hide()

Hides the Snackbar

protected virtual void Hide()

OnClosed()

This virtual method is called when Snackbar is closing and it raises the Closedevent.

protected virtual void OnClosed()

OnIsShownChanged(DependencyPropertyChangedEventArgs)

protected void OnIsShownChanged(DependencyPropertyChangedEventArgs e)

Parameters

e DependencyPropertyChangedEventArgs

OnOpened()

This virtual method is called when Snackbar is opening and it raises the Openedevent.

protected virtual void OnOpened()

Show()

Shows the Snackbar

public virtual void Show()

Show(bool)

Shows the Snackbar

public virtual void Show(bool immediately)

Parameters

immediately bool

ShowAsync()

Shows the Snackbar.

public virtual Task ShowAsync()

Returns

Task

ShowAsync(bool)

Shows the Snackbar.

public virtual Task ShowAsync(bool immediately)

Parameters

immediately bool

Returns

Task

Events

Closed

Occurs when the snackbar is about to close.

public event TypedEventHandler<Snackbar, RoutedEventArgs> Closed

Event Type

TypedEventHandler<Snackbar, RoutedEventArgs>

Opened

Occurs when the snackbar is about to open.

public event TypedEventHandler<Snackbar, RoutedEventArgs> Opened

Event Type

TypedEventHandler<Snackbar, RoutedEventArgs>