Example: In the demos layout
- A Task.Delay is required to allow the binding to occur before we know the value.
public async void SwitchTheme()
{
await Task.Delay(50);
- The code is tracking state rather than using the field
_ltr that is bound to.
public async Task SwitchDirection()
{
dir = (dir == LocalizationDirection.rtl) ? LocalizationDirection.ltr : LocalizationDirection.rtl;
This was a problem that was solved in .Net 7 when @bind-Value:after was introduced. However, because we need to continue to support .Net 6 this cannot be used.