Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

MudBlazor - MudSelectExtended Binding to a complex object and Setting a Selected Item

$
0
0

I am attempting to bind a MudSelectExtended item to a List<ComplexType> the List of items displays perfectly, but I can't set the selected item. ie: When editing an entity and setting it a value which is was previously set to.

Here is the control with the list of items populated. Note: It looks like an empty text box before I click on the dropdown button.Image

But SettingSelectedValues="_selectedQuestion"or@bind-SelectedValues = "FormSectionQuestionsContext.Item.Question"orValue="FormSectionQuestionsContext.Item.Question"

Have tried with and without MultiSelection set to true/false. I just can NOT get it to Render with an item which is already selected.

Please help.

Thanks in Advance!

<PropertyColumn Property="x => x.Question"          SortBy="x => x.Order"          InitialDirection="@MudBlazor.SortDirection.Ascending"          Title="Question"          Hidden="false"          Hideable="true"          Context="FormSectionQuestionsContext"><CellTemplate><MudStack Row><MudTooltip Text="@GridService.GetQuestionTypeText(FormSectionQuestionsContext.Item.Question.QuestionType)"><MudIcon Size="@Size.Small"                              Icon="@GridService.GetQuestionTypeStatusIcon(FormSectionQuestionsContext.Item.Question.QuestionType)"                              Color="Color.Primary">  @* @GridService.GetQuestionTypeBadgeColor(FormSectionQuestionsContext.Item.Question.QuestionType)"> *@</MudIcon></MudTooltip><MudText>@FormSectionQuestionsContext.Item.Question?.Text</MudText></MudStack></CellTemplate><EditTemplate><MudSelectExtended T="QuestionDto"                      Label="Question"                      Variant="Variant.Text"                      SelectedValues="_selectedQuestion"                      MultiSelection="true"                      ItemCollection="_questions"                      SearchBox="true"                      SearchBoxAutoFocus="true"                      SearchFunc="@(new Func<QuestionDto, string, bool>(SearchQuestions))"                      ChipCloseable="true"                      ChipSize="Size.Small"                      ChipVariant="Variant.Outlined"                      NoWrap="true"                      ValuePresenter="ValuePresenter.ItemContent"><ItemTemplate Context="fsqc2"><MudStack Class="mud-width-full" Justify="Justify.SpaceBetween"><MudStack Row="true" Spacing="1"><MudIcon Size="Size.Small"                                      Icon="@GridService.GetQuestionTypeStatusIcon(fsqc2!.Value!.QuestionType)"                                      Color="@GridService.GetQuestionTypeBadgeColor(fsqc2!.Value!.QuestionType)" /><MudText>@($"{fsqc2.Value.Id} {fsqc2.Value.Text}")</MudText></MudStack></MudStack></ItemTemplate></MudSelectExtended> </EditTemplate></PropertyColumn>

Versions I am using:

  • CodeBeam.MudBlazor.Extensions v8.0.0
  • MudBlazor v8.4.0
  • Blazor .NET 9.0.3

FYI: Also cross posted an issue in Github.GitHub Issue - Click Here


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>