In my opinion the best solution is igrali's solution, because he respect the guideline.
But if you want show Toast same Android :
Create userControl like this :
<Border CornerRadius="50" Background="#CC000000" Height="80" Width="150" Margin="10">
<TextBlock Text="{Binding Message}" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
In code behind :
public MyUserControl1()
{
this.InitializeComponent();
this.DataContext = this;
}
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
// Using a DependencyProperty as the backing store for Message. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(MyUserControl1), new PropertyMetadata(string.Empty));
And use this userControl in your page :
private MyUserControl1 toast;
private DispatcherTimer timer = new DispatcherTimer();
private void Button_Click(object sender, RoutedEventArgs e)
{
toast = new MyUserControl1();
toast.Message = "Message in my toast";
toast.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Bottom;
toast.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
timer.Interval = new TimeSpan(0, 0, 1);
timer.Start();
timer.Tick += timer_Tick;
layoutRoot.Children.Add(toast);
}
void timer_Tick(object sender, object e)
{
if(toast != null)
layoutRoot.Children.Remove(toast);
timer.Stop();
}
I create a button, and fired click event.
In this event i create my usercontrol and add in grid (layoutRoot).
I use a DispatcherTimer for remove user control after one seconde.
[Edit]
There you are with a working base. Of course you can greatly improve the code.
For example, create an enum that defines the display time.
You can also create a Storyboard to run an animation.