How to make UIContainerAdv fit custom control

Hello,

I'm developing a rich text editor with some interesting features. Is there any way to let UIContainerAdv's size fit my custom control automatically? Specifically, i only need the UIContainerAdv's width to fit my code-generated text. My custom control is quite simple. It's only include a button and two textblock side-by-side. I guarantee that all contents could rendered in one line.

thanks



3 Replies

KG Kalaivannan Ganesan Syncfusion Team August 9, 2024 08:19 AM UTC

Guangy, we are validating the process of changing the UIContainerAdv size based on its child elements as per your requirement. We will complete the validation and update you with the details on or before August 13, 2024.



KG Kalaivannan Ganesan Syncfusion Team August 13, 2024 07:15 AM UTC

Guangy, we have confirmed the reported issue with “UIContainerAdv size remains unchanged when modified at runtime” and have logged the bug report in SfRichTextBoxAdv. The fix for this issue will be included in our upcoming Essential Studio weekly NuGet release, which is estimated to be available on 27th August 2024. With this fix, you will be able to fit the
UIContainerAdv size to your custom control.

Please use the below feedback to track the status of the reported issue
https://www.syncfusion.com/feedback/60357/uicontaineradv-size-remains-unchanged-when-modified-at-runtime

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.



KG Kalaivannan Ganesan Syncfusion Team August 27, 2024 11:48 AM UTC

Guangy, as promised earlier, we have included the fix for the reported bug with “UIContainerAdv size remains unchanged when modified at runtime” in our latest weekly NuGet release (v26.2.11).

Root cause of the issue:
When Width and Height are set in the backend, the WidthChanged and HeightChanged events are triggered, and the width and height are updated. However, no relayout takes place. Consequently, the UI elements retain their previous values, and no visible changes are reflected at the UI level.

Please use the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.SfRichTextBoxAdv.WPF/26.2.11

The status of this bug task can be tracked through the below link:
UIContainerAdv size remains unchanged when modified at runtime


UIContainerAdv is simply a node that contains details such as height, width, and a UI element. It is not an element that is preserved at the UI level. The UIElement you mentioned in UIContainerAdv will alone be rendered in SfRichTextBoxAdv, which will be shown at the UI level. The height and width specified in UIContainerAdv are used, ignoring the height and width of the UIElement.

So, even if the UIElement's dimensions are larger than those of the UIContainerAdv, only the dimensions of UIContainerAdv will be used during rendering.

To adapt the sizes of UIContainerAdv to the UIElement, set the size of the UIElement to match the height and width of UIContainerAdv.

We have created a sample application where UIContainerAdv contains a StackPanel with two TextBlocks and buttons in it. In the SizeChanged event of the StackPanel, we have assigned the height and width of the StackPanel to the UIContainerAdv, so that UIContainerAdv fits the custom control.

We have also prepared a sample application for your reference. Please refer to the attached application for more information.


Attachment: SfRichTextBoxAdv_UIContainerAdv_WPF_85a0d798.zip

Loader.
Up arrow icon