-
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathFlutterViewModel.cs
More file actions
19 lines (14 loc) · 730 Bytes
/
FlutterViewModel.cs
File metadata and controls
19 lines (14 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
namespace WpfCsMarkupExamples;
public class FlutterViewModel : BaseViewModel
{
ICommand? toggleMoreCommand, backCommand;
List<string>? subTitles;
public string Title { get; set; } = "Flutter-Like UI markup";
public bool ShowMore { get; set; } = true;
public string ToggleMoreText => ShowMore ? "Show less" : "Show more";
public List<string> Subtitles => subTitles ??= new List<string>() { "Subtitle 1", "Subtitle 2", "Subtitle 3" };
public ICommand ToggleMoreCommand => toggleMoreCommand ??= new RelayCommand(ToggleMore);
public ICommand BackCommand => backCommand ??= new RelayCommand(Back);
void ToggleMore() { ShowMore = !ShowMore; }
void Back() => App.Current?.NavigateBack();
}