-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathExpanderPage.xaml.cs
More file actions
33 lines (27 loc) · 939 Bytes
/
ExpanderPage.xaml.cs
File metadata and controls
33 lines (27 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Sample.ViewModels.Views;
namespace CommunityToolkit.Maui.Sample.Pages.Views;
public partial class ExpanderPage : BasePage<ExpanderViewModel>
{
public ExpanderPage(ExpanderViewModel viewModel) : base(viewModel)
{
InitializeComponent();
}
Stopwatch stopWatch = new();
void Expander_ExpandedChanging(object? sender, Core.ExpandedChangingEventArgs e)
{
stopWatch.Restart();
}
async void Expander_ExpandedChanged(object? sender, Core.ExpandedChangedEventArgs e)
{
stopWatch.Stop();
var collapsedText = e.IsExpanded ? "expanded" : "collapsed";
await Toast.Make($"Expander is {collapsedText} ({stopWatch.ElapsedMilliseconds} ms)").Show(CancellationToken.None);
}
async void GoToCSharpSampleClicked(object? sender, EventArgs? e)
{
await Navigation.PushAsync(new ExpanderPageCS());
}
}