Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding value dynamically using parameters to the InputTextarea in the OnBindingContextChanged after some delay, the value not updated properly. #22486

Open
VinithaJeyakumar opened this issue May 17, 2024 · 5 comments
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@VinithaJeyakumar
Copy link

Description

  • When we try to bind a value to the InputTextarea in the Razor file using some parameter in the OnBindingContextChanged function after some delay of 2000ms, the dynamically added value is not reflected in the text area.

Steps to Reproduce

  1. Create a InputTextarea in the Razor file with bind-value variable as parameter.
  2. pass value to the variable using parameter in the OnBindingContextChanged function in Xaml.cs file with some delay.
  3. Now run the sample and check the value.

Code snippet:
-----Razor page----

<InputTextArea @bind-Value ="@TextContent">

@code {

[Parameter]
public string TextContent{ get; set; }

-----Xaml.cs--------

protected override async void OnBindingContextChanged()
{
    base.OnBindingContextChanged();
    //await viewModel.Init();

    new Task(async () =>
    {
        await Task.Delay(2000);
        //viewModel.College.Details = @"<h1> College Information</h1>";
        var details = "From OnBindingContextChanged";

        rootComponent.Parameters =
        new Dictionary<string, object>
        {
            { "TextContent",  details}
        };
    }).Start();

}

Link to public reproduction project repository

No response

Version with bug

9.0.0-preview.3.10457

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@VinithaJeyakumar VinithaJeyakumar added the t/bug Something isn't working label May 17, 2024
@PureWeen PureWeen added s/needs-repro Attach a solution or code which reproduces the issue area-blazor Blazor Hybrid / Desktop, BlazorWebView labels May 17, 2024
@manjunath-vadigeri
Copy link

I have attached a sample project where I can reproduce the issue -
CIllustrationPage.xaml has a BlazorWebView whose root component in CIllustration.razor
CIllustration.razor has a SfRichTextEditor whose content property should be dynamically set

In CIllustrationPage.xaml.cs constructor, if I set the parameters => they appear coorectly in RichTextEditor
But my content is not yet available at this point.

So, I tried to set the parameters in OnBindingContextChanged method where my data is available.
[In the app, I have simulated a delay to represent real data-fetch scenario]

This newly set parameters are not notified to the RichTextEditor
Uploading ParameterIssue.zip…

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels May 21, 2024
@kevinxufei
Copy link
Collaborator

Hi, @manjunath-vadigeri, thank you for providing the repo, but the link of this sample project seems to be incorrect, please upload it again.

@manjunath-vadigeri
Copy link

Hello @kevinxufei ,
I have shared the sample project as a public repo here -
https://github.com/manjunath-vadigeri/ParameterIssue

@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels May 24, 2024
@kevinxufei
Copy link
Collaborator

kevinxufei commented May 24, 2024

Verified this issue with Visual Studio 17.11 Preview 1 (9.0.0-preview.2.10293/9.0.0-preview.4.10690) + .Net9SDK 9.0.100-preview.4.24267.66. Can repro it on Windows platform.

@manjunath-vadigeri
Copy link

While the MAUI team further checks the issue, Is there any work around to overcome this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants