Unplanned
Last Updated: 25 Mar 2024 11:50 by Martin Ivanov
Martin Ivanov
Created on: 25 Mar 2024 11:50
Category: RibbonView
Type: Bug Report
0
RibbonView: Wrong size of the popup showing the minimized tab content after changing the size of the RibbonView in the Windows 11 theme

The width of the popup element that shows the selected tab content when RadRibbonView is minimized is wrong in the following situation. A tab in the minimized ribbon is clicked to display its content, then the tab is clicked again. After that, the width of the ribbon is changed. At this point when you open the minimized content, the popup uses the previous size of the RadRibbonView control. 

To work this around, you can manually update the MaxWidth of the popup content element on size changed.

public class CustomRibbonView : RadRibbonView
{
    private ContentPresenter popupContent;

    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
        this.popupContent = this.GetTemplateChild("SelectedTabContentPopup") as ContentPresenter;
    }

    protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
    {
        base.OnRenderSizeChanged(sizeInfo);
        if (popupContent != null)
        {
            double popupContentPadding = 16;
            popupContent.MaxWidth = this.ActualWidth - popupContentPadding;
        }
    }
}

0 comments