|
| 1 | +@namespace MudExtensions.Docs.Examples |
| 2 | +@inject ISnackbar Snackbar |
| 3 | +@using MudBlazor.Extensions |
| 4 | +@using MudExtensions.Utilities |
| 5 | + |
| 6 | +<MudGrid> |
| 7 | + <MudItem xs="12" sm="8"> |
| 8 | + <MudStack Class="mud-width-full" AlignItems="AlignItems.Center"> |
| 9 | + <MudWatch @ref="_watch" Interval="TimeSpan.FromSeconds(1)" Mode="WatchMode.Watch" |
| 10 | + Wheel="_wheel" ShowHour="_showHour" ShowMinute="_showMinute" ShowSecond="_showSecond" ShowMillisecond="_showMillisecond" |
| 11 | + TimeZone="_selectedTimeZone" /> |
| 12 | + </MudStack> |
| 13 | + </MudItem> |
| 14 | + |
| 15 | + <MudItem xs="12" sm="4"> |
| 16 | + <MudStack Spacing="4"> |
| 17 | + <MudSelectExtended @bind-Value="_selectedTimeZone" Label="TimeZone" Dense="true" SearchBox="true" ToStringFunc="@(tz => $"{tz.DisplayName} ({tz.Id})")"> |
| 18 | + @foreach (var tz in _timeZones) |
| 19 | + { |
| 20 | + <MudSelectItemExtended Value="tz"> |
| 21 | + @tz.DisplayName (@tz.Id) |
| 22 | + </MudSelectItemExtended> |
| 23 | + } |
| 24 | + |
| 25 | + </MudSelectExtended> |
| 26 | + <MudSwitchM3 @bind-Value="_wheel" Color="Color.Secondary" Label="Wheel" /> |
| 27 | + <div class="d-flex flex-wrap gap-4"> |
| 28 | + <MudSwitchM3 @bind-Value="_showHour" Color="Color.Secondary" Label="Show Hour" /> |
| 29 | + <MudSwitchM3 @bind-Value="_showMinute" Color="Color.Secondary" Label="Show Minute" /> |
| 30 | + <MudSwitchM3 @bind-Value="_showSecond" Color="Color.Secondary" Label="Show Second" /> |
| 31 | + <MudSwitchM3 @bind-Value="_showMillisecond" Color="Color.Secondary" Label="Show Millisecond" /> |
| 32 | + </div> |
| 33 | + </MudStack> |
| 34 | + </MudItem> |
| 35 | +</MudGrid> |
| 36 | + |
| 37 | +@code { |
| 38 | + MudWatch _watch = new(); |
| 39 | + bool _wheel; |
| 40 | + bool _showHour = true; |
| 41 | + bool _showMinute = true; |
| 42 | + bool _showSecond = true; |
| 43 | + bool _showMillisecond = false; |
| 44 | + |
| 45 | + private List<TimeZoneInfo> _timeZones = new(); |
| 46 | + private TimeZoneInfo _selectedTimeZone = TimeZoneInfo.Utc; |
| 47 | + |
| 48 | + protected override void OnInitialized() |
| 49 | + { |
| 50 | + _timeZones = TimeZoneInfo.GetSystemTimeZones().ToList(); |
| 51 | + _selectedTimeZone = TimeZoneInfo.Local; |
| 52 | + } |
| 53 | +} |
0 commit comments