Hi,
I can't seem to get the SfRichTextEditor to scale vertically with the parent element using this code.
<div class="col-md-6 my-2 d-flex border" style="height: calc(100vh / 2 - 20rem);">
<SfRichTextEditor Height="100%" Width="100%" @bind-Value="@MyProduct.Description">
</SfRichTextEditor>
</div>
The SfRichTextEditor does scale in the horizontal direction OK.
The code above works fine with the SfListView and SfGrid controls.
Can you let me know what I am doing wrong here?
Many thanks, Stuart
Hi Gunasekar,
To be clear the following code does work in the SfListView and SfGrid controls.
style="height: calc(100vh / 2 - 20rem);"
But does not work in the SfRichTextEditor control.
The attached screenshot shows this working correctly with the SfListView control but NOT with the SfRichTextEditor control.
Do you know why is this behaviour different?
I have attached a screenshot and a simple Blazor project showing the issue.
Many thanks, Stuart
|
<SfRichTextEditor @ref="RteObj" Height="100%" Width="100%">
<RichTextEditorEvents Created="OnCreate"></RichTextEditorEvents> </SfRichTextEditor>@code {
SfRichTextEditor RteObj;
public async Task OnCreate()
{
{
await RteObj.RefreshUI();
}
} } |
Hi Gunasekar, I have now fixed this by using your suggestion as follows;
1) Added the following nuget package to the project
BlazorPro.BlazorSize
2) Added the following to startup.cs
services.AddScoped<IResizeListener, ResizeListener>();
3) Injected the service on the page in question (I'm using code behind)
[Inject] private IResizeListener _listener { get; set; }4) Added the following code to update the component on page resize
private SfRichTextEditor _rteDescription;
private async void WindowResizedAsync(object _, BrowserWindowSize window) => await _rteDescription.RefreshUI();
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
_listener.OnResized += WindowResizedAsync;
}
This now works fine, I hope this helps anyone else out that is having this problem. Thank you for all your wonderful assistance.
Kind regards, Stuart