RadRibbonGallery Automatic Resizing?

3 posts, 0 answers
  1. Melissa
    Melissa avatar
    5 posts
    Member since:
    Jan 2014

    Posted 05 Feb 2014 Link to this post

    Is there a way to have a RadRibbonGallery automatically resize its width based on the content available when the window is resized? I currently have the ViewportWidth set to display three of the items it contains, but if there is more window space available I would like for it to display as many as possible and fill up the remaining whitespace in the ribbon. I have seen this functionality in MS Word with the Styles gallery.
  2. Martin Ivanov
    Martin Ivanov avatar
    1442 posts

    Posted 10 Feb 2014 Link to this post

    Hi Melissa,

    Unfortunately, the described functionality is not supported out of the box, but it could be achieved by using some custom logic. I prepared a sample project to demonstrate the approach which I used to implement this behavior. Almost all of the logic is handled in the SizeChanged event handler of the MainWindow. Basically I am changing the values of the Width, ViewportWidth and the PopupViewportWidth properties of the RadRibbonGallery, based on the window width: 
    private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
        //First reset the RibbonGallery Width properties based on the group state and the empty space in the ribbon tab
        //Then calculate the size of the gallery
        var windowOffset = this.Width - this.PreviousWindowSize;
        var galleryNewWidth = this.RibbonGallery.Width + windowOffset;
        var viewportNewWidth = this.RibbonGallery.ViewportWidth + windowOffset;
        this.PreviousWindowSize = this.Width;
        this.RibbonGallery.Width = Math.Max(this.RibbonGallery.MinWidth, galleryNewWidth);
        this.RibbonGallery.ViewportWidth = Math.Max(this.RibbonGallery.MinWidth, viewportNewWidth);
        this.RibbonGallery.PopupViewportWidth = Math.Min(this.RibbonGallery.MaxWidth, viewportNewWidth);

    Please give this approach a try and let me know if it helps.


    Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

  3. Melissa
    Melissa avatar
    5 posts
    Member since:
    Jan 2014

    Posted 10 Feb 2014 in reply to Martin Ivanov Link to this post

    Thanks, this helps.
Back to Top