-
Notifications
You must be signed in to change notification settings - Fork 12
Toast
Namespace: DIPS.Xamarin.UI.Controls.Toast
A Toast view appears over the active page. Commonly used to give feedback to users of certain activities. The user can also interact with the Toast.
Only one Toast will be displayed at a given time in the active page. If a toast is set to display while there is a previous toast on screen, the previous toast will be closed immediately allowing way to display the new toast.
Source Code can be found here
Samples can be found here
👉 To get started, make sure you have followed the getting started steps
Import the Toast control with the following using statement,
using DIPS.Xamarin.UI.Controls.Toast;
First, the Toast control should be Initialized
in the App.xaml.cs
file.
public App()
{
InitializeComponent();
// some code
Toast.Current.Initialize();
// some code
}
The DisplayToast
method displays the Toast in the currently Active page. This method has two overloads.
Both methods intake a string
, which will be the displayed Text
. ToastOptions
is used to set the basic options for the Toast and ToastLayout
is used to define the layout of the Toast.
The first overload is,
var options = new ToastOptions();
var layout = new ToastLayout();
Toast.Current.DisplayToast(title, options, layout));
you can also display the toast using the other overloaded method,
Toast.Current.DisplayToast(title, options => { }, layout => { }));
The following method simply closes the toast on screen.
Toast.Current.CloseToast();
On iOS
On Android
Property | Explanation | Remarks | default value |
---|---|---|---|
Current |
A static property holding an active Toast instance |
This is a static property |
new Toast() |
- ContentControl
- DataTemplateSelectors
- Date- and TimePicker
- Modality
- Contextual Menus
- RadioButton
- TrendGraph
- Tag
- Toast