Adding value dynamically using parameters to the InputTextarea in the OnBindingContextChanged after some delay, the value not updated properly.
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
- Create a InputTextarea in the Razor file with bind-value variable as parameter.
- pass value to the variable using parameter in the OnBindingContextChanged function in Xaml.cs file with some delay.
- Now run the sample and check the value.
Code snippet: -----Razor page----
<InputTextArea @bind-Value ="@TextContent"></InputTextArea>
@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
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…
Hi, @manjunath-vadigeri, thank you for providing the repo, but the link of this sample project seems to be incorrect, please upload it again.
Hello @kevinxufei , I have shared the sample project as a public repo here - https://github.com/manjunath-vadigeri/ParameterIssue
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.
While the MAUI team further checks the issue, Is there any work around to overcome this issue?
Thanks for contacting us. Changing existing root components is not supported. Consider utilizing a shared service to pass information between native and Razor context.