Skip to content

Commit ef7763e

Browse files
committed
Snackbar demo
1 parent 73adf9e commit ef7763e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

MainDemo.Wpf/Snackbar.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<Grid.ColumnDefinitions>
1313
<ColumnDefinition Width="250" />
1414
<ColumnDefinition Width="250" />
15+
<ColumnDefinition Width="250" />
1516
</Grid.ColumnDefinitions>
1617
<Grid.RowDefinitions>
1718
<RowDefinition Height="auto" />
@@ -22,6 +23,8 @@
2223
<Button Grid.Row="2" Content="SHOW" Width="80" Click="ShowSimpleSnackbarButtonClickHandler" />
2324
<TextBlock Grid.Column="1" Margin="8,0" Text="This button shows a Snackbar with an action. The action will show another Snackbar after a short delay." TextWrapping="WrapWithOverflow" />
2425
<Button Grid.Column="1" Grid.Row="2" Content="SHOW" Width="80" Click="ShowSnackbarButtonClickHandler" />
26+
<TextBlock Grid.Column="2" Margin="8,0" Text="A click on the button shows a multiline Snackbar." TextWrapping="WrapWithOverflow" />
27+
<Button Grid.Column="2" Grid.Row="2" Content="SHOW" Width="80" Click="ShowMultilineSnackbarButtonClickHandler" />
2528
</Grid>
2629
</ScrollViewer>
2730
</Grid>

MainDemo.Wpf/Snackbar.xaml.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,19 @@ private async void ShowSimpleSnackbarButtonClickHandler(object sender, RoutedEve
3131

3232
private async void ShowSnackbarButtonClickHandler(object sender, RoutedEventArgs args)
3333
{
34-
await SnackbarHost.ShowAsync("RootSnackbarHost", "Hello from the Snackbar!", new SnackbarAction("GOT IT", async (object s, RoutedEventArgs a) => {
34+
await SnackbarHost.ShowAsync("RootSnackbarHost", "Hello from the Snackbar!", new SnackbarAction("HELLO", async (object s, RoutedEventArgs a) => {
3535
await Task.Delay(2000);
3636

3737
await SnackbarHost.ShowAsync("RootSnackbarHost", "A second hello from the Snackbar!", new SnackbarAction("BYE"));
3838
}));
3939
}
40+
41+
private async void ShowMultilineSnackbarButtonClickHandler(object sender, RoutedEventArgs args)
42+
{
43+
await SnackbarHost.ShowAsync(
44+
"RootSnackbarHost",
45+
"The specs says that the maximum with should be 568dp. However there sould be at most only two lines of text.",
46+
new SnackbarAction("GOT IT"));
47+
}
4048
}
4149
}

0 commit comments

Comments
 (0)