-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathDateTimePickerExample1.razor
More file actions
55 lines (52 loc) · 2.54 KB
/
DateTimePickerExample1.razor
File metadata and controls
55 lines (52 loc) · 2.54 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@namespace MudExtensions.Docs.Examples
@using MudBlazor.Extensions
<MudGrid>
<MudItem xs="12" sm="8">
<MudDateTimePicker @bind-Value="_date" Editable="_editable" Label="Date" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color"
Format="@_dateFormat"
TransformOrigin="Origin.TopCenter" AnchorOrigin="Origin.BottomCenter" />
</MudItem>
<MudItem xs="12" sm="4">
<MudStack Spacing="4">
<MudSelect @bind-Value="_dateView" Variant="Variant.Outlined" Label="Date View">
@foreach (DateView item in Enum.GetValues<DateView>())
{
<MudSelectItem Value="item">@item.ToDescriptionString()</MudSelectItem>
}
</MudSelect>
<MudSelect @bind-Value="_variant" Variant="Variant.Outlined" Label="Variant">
@foreach (Variant item in Enum.GetValues<Variant>())
{
<MudSelectItem Value="item">@item.ToDescriptionString()</MudSelectItem>
}
</MudSelect>
<MudSwitchM3 @bind-Value="_editable" Color="Color.Secondary" Label="Editable" />
<MudSwitchM3 @bind-Value="_showToolbar" Color="Color.Secondary" Label="Show Toolbar" />
<MudSwitchM3 @bind-Value="_showHeader" Color="Color.Secondary" Label="Show Header" />
<MudSwitchM3 @bind-Value="_submitOnClose" Color="Color.Secondary" Label="Submit On Close" />
<MudSwitchM3 @bind-Value="_isAdornmentEnd" Label="Adornment End" Color="Color.Secondary" />
<MudSelect @bind-Value="_color" Variant="Variant.Outlined" Label="Color">
@foreach (Color item in Enum.GetValues<Color>())
{
<MudSelectItem Value="item">@item.ToDescriptionString()</MudSelectItem>
}
</MudSelect>
<MudTextField @bind-Value="_dateFormat" Variant="Variant.Outlined" Label="Date Format" />
<MudButton OnClick="@(() => _date = DateTime.Now)">Set Today</MudButton>
</MudStack>
</MudItem>
</MudGrid>
@code {
private DateTime? _date = DateTime.Now;
private DateView _dateView = DateView.Date;
private bool _editable = false;
private bool _showToolbar = true;
private bool _showHeader = true;
private bool _submitOnClose = true;
private Color _color = Color.Primary;
private string? _dateFormat;
private bool _isAdornmentEnd = true;
private bool _clearable = false;
private Variant _variant = Variant.Outlined;
}