|
10 | 10 | } |
11 | 11 | </MudSelectExtended> |
12 | 12 |
|
13 | | - <MudSelectExtended MultiSelectionTextFunc="@(_radioGroup?.Value == 1 ? new Func<List<string>, string?>(GetMultiSelectionText2) : null)" MultiSelection="true" ValuePresenter="_valuePresenter" @bind-Value="stringValue" @bind-SelectedValues="stringValues" T="string" Label="US States" AnchorOrigin="Origin.BottomCenter" |
| 13 | + <MudSelectExtended MultiSelectionTextFunc="@(_radioGroup?.Value == 1 ? new Func<List<string>, string?>(GetMultiSelectionText2) : null)" MultiSelection="true" ValuePresenter="_valuePresenter" @bind-Value="_stringValue" @bind-SelectedValues="_stringValues" T="string" Label="US States" AnchorOrigin="Origin.BottomCenter" |
14 | 14 | ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" NoWrap="_nowrap"> |
15 | 15 | @foreach (var state in states) |
16 | 16 | { |
17 | 17 | <MudSelectItemExtended T="string" Value="@state" Text="@state" /> |
18 | 18 | } |
19 | 19 | </MudSelectExtended> |
20 | 20 |
|
21 | | - <MudSelectExtended ItemCollection="states" MultiSelectionTextFunc="@(_radioGroup?.Value == 1 ? new Func<List<string>, string?>(GetMultiSelectionText2) : null)" MultiSelection="true" ValuePresenter="_valuePresenter" @bind-Value="stringValue" @bind-SelectedValues="stringValues" T="string" Label="US States" AnchorOrigin="Origin.BottomCenter" |
| 21 | + <MudSelectExtended ItemCollection="states" MultiSelectionTextFunc="@(_radioGroup?.Value == 1 ? new Func<List<string>, string?>(GetMultiSelectionText2) : null)" MultiSelection="true" ValuePresenter="_valuePresenter" @bind-Value="_stringValue" @bind-SelectedValues="_stringValues" T="string" Label="US States" AnchorOrigin="Origin.BottomCenter" |
22 | 22 | ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" NoWrap="_nowrap"> |
23 | 23 | </MudSelectExtended> |
24 | 24 |
|
|
38 | 38 |
|
39 | 39 | <MudItem xs="12" sm="4"> |
40 | 40 | <MudRadioGroup @ref="_radioGroup" T="int" ValueChanged="GroupOptionChanged"> |
41 | | - <MudRadio Value="0" Color="Color.Primary">Standard Text</MudRadio> |
42 | | - <MudRadio Value="1" Color="Color.Primary">Customized Text</MudRadio> |
43 | | - <MudRadio Value="2" Color="Color.Primary">Chip</MudRadio> |
| 41 | + <MudRadio Value="0" Color="Color.Secondary">Standard Text</MudRadio> |
| 42 | + <MudRadio Value="1" Color="Color.Secondary">Customized Text</MudRadio> |
| 43 | + <MudRadio Value="2" Color="Color.Secondary">Chip</MudRadio> |
44 | 44 | </MudRadioGroup> |
45 | 45 | <MudGrid Class="mt-3 px-4"> |
46 | 46 | <MudItem xs="6"> |
47 | 47 | <MudText Typo="Typo.subtitle2">Value:</MudText> |
48 | 48 | <MudText Typo="Typo.subtitle2">"</MudText> |
49 | | - <MudText Typo="Typo.body2" Class="pl-4">@stringValue</MudText> |
| 49 | + <MudText Typo="Typo.body2" Class="pl-4">@_stringValue</MudText> |
50 | 50 | <MudText Typo="Typo.subtitle2">"</MudText> |
51 | 51 | </MudItem> |
52 | 52 | <MudItem xs="6"> |
53 | 53 | <MudText Typo="Typo.subtitle2">SelectedValues: HashSet<string></MudText> |
54 | 54 | <MudText Typo="Typo.subtitle2">{</MudText> |
55 | | - <MudText Typo="Typo.body2" Class="pl-4">@(string.Join(", ", stringValues.Select(x => $"\"{x}\"")))</MudText> |
56 | | - <MudText Typo="Typo.subtitle2">}</MudText> |
57 | | - </MudItem> |
58 | | - </MudGrid> |
59 | | - <MudSwitchM3 @bind-Value="_chipCloseable" Label="Chip Closeable" Color="Color.Primary" /> |
60 | | - <MudSwitchM3 @bind-Value="_nowrap" Label="Nowrap" Color="Color.Primary" /> |
61 | | - <MudSelectExtended Class="mt-4" ItemCollection="@(Enum.GetValues<Variant>())" @bind-Value="_chipVariant" Label="Chip Variant" Variant="Variant.Outlined" Margin="Margin.Dense" /> |
62 | | - <MudSelectExtended Class="mt-4" ItemCollection="@(Enum.GetValues<Size>())" @bind-Value="_chipSize" Label="Chip Size" Variant="Variant.Outlined" Margin="Margin.Dense" /> |
63 | | - </MudItem> |
64 | | - </MudGrid> |
| 55 | + <MudText Typo="Typo.body2" Class="pl-4">@(string.Join(", ", _stringValues.Select(x => $"\"{x}\"")))</MudText> |
| 56 | + <MudText Typo="Typo.subtitle2">}</MudText> |
| 57 | + </MudItem> |
| 58 | + </MudGrid> |
| 59 | + <MudSwitchM3 @bind-Value="_chipCloseable" Label="Chip Closeable" Color="Color.Secondary" /> |
| 60 | + <MudSwitchM3 @bind-Value="_nowrap" Label="Nowrap" Color="Color.Secondary" /> |
| 61 | + <MudSelectExtended Class="mt-4" ItemCollection="@(Enum.GetValues<Variant>())" @bind-Value="_chipVariant" Label="Chip Variant" Variant="Variant.Outlined" Margin="Margin.Dense" /> |
| 62 | + <MudSelectExtended Class="mt-4" ItemCollection="@(Enum.GetValues<Size>())" @bind-Value="_chipSize" Label="Chip Size" Variant="Variant.Outlined" Margin="Margin.Dense" /> |
| 63 | + </MudItem> |
| 64 | +</MudGrid> |
65 | 65 |
|
66 | | - @code { |
67 | | - MudRadioGroup<int>? _radioGroup; |
68 | | - ValuePresenter _valuePresenter = ValuePresenter.Text; |
69 | | - string stringValue { get; set; } = "Nothing selected"; |
70 | | - IEnumerable<string> stringValues { get; set; } = new HashSet<string>() { "Alaska", "California" }; |
71 | | - int? intValue; |
72 | | - IEnumerable<int?> intValues { get; set; } = new HashSet<int?>() { 2, 3 }; |
73 | | - bool _chipCloseable = false; |
74 | | - Variant _chipVariant = Variant.Filled; |
75 | | - Size _chipSize = Size.Small; |
76 | | - bool _nowrap; |
| 66 | +@code { |
| 67 | + private MudRadioGroup<int>? _radioGroup; |
| 68 | + private ValuePresenter _valuePresenter = ValuePresenter.Text; |
| 69 | + private string _stringValue = "Nothing selected"; |
| 70 | + private IEnumerable<string> _stringValues = new HashSet<string>() { "Alaska", "California" }; |
| 71 | + private int? intValue; |
| 72 | + private IEnumerable<int?> intValues { get; set; } = new HashSet<int?>() { 2, 3 }; |
| 73 | + private bool _chipCloseable = false; |
| 74 | + private Variant _chipVariant = Variant.Filled; |
| 75 | + private Size _chipSize = Size.Small; |
| 76 | + private bool _nowrap; |
77 | 77 |
|
78 | 78 | public class Complex |
79 | 79 | { |
|
0 commit comments