File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,20 @@ The `SelectedItemChanged` event fires every time the user clicks on a new item f
4444 Console.WriteLine($"The user selected {item.Text}");
4545 }
4646
47+ protected override void OnInitialized()
48+ {
49+ //You can preselect an item in the lifecycle methods that the framework provides.
50+ selectedItem = Data.FirstOrDefault();
51+ //Here you can use another LINQ expressions like Where() or else depending on your application needs.
52+ }
53+
4754 public DrawerItem selectedItem { get; set; }
4855 public IEnumerable<DrawerItem> Data { get; set; } =
4956 new List<DrawerItem>
5057 {
5158 new DrawerItem { Text = "Counter", Icon = IconName.Plus},
5259 new DrawerItem { Text = "FetchData", Icon = IconName.GridLayout},
53- };
60+ };
5461
5562 public class DrawerItem
5663 {
You can’t perform that action at this time.
0 commit comments