Skip to content

Switch can't display read only properties #1151

@endstreetNew

Description

@endstreetNew

NOTE: We do not look at .zip attachments for issue investigation.

Describe the bug
Switch Component doesn't handle readonly properties and should fail with appropriate error.

To Reproduce
Steps to reproduce the behavior:

@* Can't compile @
<Switch @bind-Value="Error1" Disabled="true" />
@
Fails at runtime *@

@code {
protected bool Error1 {get;}
//With Switch failing on read only properties ,you cant use switch to display bools.
}

Expected behavior
Use Switch to display value off bools always.

Screenshots
Problem is simple and persistent

Versions (please complete the following information):

  • .NET Version: [ .NET 9]
  • BlazorBootstrap: [current]
  • Blazor Server, possibly all
  • Blazor Server, None]
  • Global Routes @rendermode="new InteractiveServerRenderMode(prerender: false)"

Sample code
@* Can't compile @
<Switch @bind-Value="Error1" Disabled="true" />
@
Fails at runtime *@

@code {
protected bool Error1 {get;}
//With Switch failing on read only properties ,you cant use switch to display bools.
}

GitHub repo
not

Desktop (please complete the following information):

  • All
  • All
  • All

Smartphone (please complete the following information):

  • All

Additional context

Expected behaviour is to be able do display readonly properties on all "View" pages in any component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions