MudToggleGroup doesn't cascade nullable value type
Bug type
Component
Component name
MudToggleGroup
What happened?
Creating a MudToggleGroup for an int? will make it vertical and unselectable due to _items not filling correctly resulting in the invalid value: grid-template-columns: repeat(0, minmax(0, 1fr)).
I use the int? to be null when none are selected like when an item is toggled off.
<MudToggleGroup T="int?" @bind-Value="Point.ScaleIndex" SelectionMode="SelectionMode.ToggleSelection" Color="Color.Primary" Dense CheckMark FixedContent>
<MudToggleItem Value="0"><MudText Typo="Typo.subtitle2">None</MudText></MudToggleItem>
<MudToggleItem Value="1"><MudText Typo="Typo.subtitle2">Low</MudText></MudToggleItem>
<MudToggleItem Value="3"><MudText Typo="Typo.subtitle2">Medium</MudText></MudToggleItem>
<MudToggleItem Value="5"><MudText Typo="Typo.subtitle2">High</MudText></MudToggleItem>
</MudToggleGroup>
Expected behavior
Items should be horizontal, selectable, and none being selected should make Value null.
Reproduction link
https://try.mudblazor.com/snippet/cuGIkGmyYndnLmCx
Reproduction steps
...
Relevant log output
No response
Version (bug)
6.15.0
Version (working)
No response
What browsers are you seeing the problem on?
Microsoft Edge
On what operating system are you experiencing the issue?
Windows
Pull Request
- [ ] I would like to do a Pull Request
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
It seems like if you explicitly add T to the MudToggleItem it works correctly
https://try.mudblazor.com/snippet/caGeEcGoenvqZlte
I'm not sure why the [CascadingTypeParameter(nameof(T))] is not working fully correctly.
This also works for me:
<MudToggleItem Value="@((int?)42)">
https://github.com/dotnet/razor/issues/10201