RadGalleryElement display issue

2 posts, 1 answers
  1. Kun
    Kun avatar
    44 posts
    Member since:
    Aug 2018

    Posted 19 Feb 2019 Link to this post

    Hello,

    I use a RadGalleryElement in my ribbonbar. I found that after I expanded gallery and then re-collapsed, the collapsed gallery size will be changed automatically. Please see the first attached photo. How can I keep the size of gallery unchanged (original one or the smaller one) ?

    FYI,

    My gallery is autosize = true, the items are added dynamically at the form loading.

    I've tried autosize=false, the gallery is completely disappeared. Weird.

    Second question, how can I display selected item effect as the second attached photo ? I found few theme can support selected item effect, like windows 7 theme. But I use windows 8 theme.

    How can I show selected item effect in program ? If not possible, please tell me which property I can modify in theme.

    Thank you.

     

     

  2. Answer
    Hristo
    Admin
    Hristo avatar
    1520 posts

    Posted 20 Feb 2019 Link to this post

    Hello Kun,

    Thank you for writing.

    The AutoSize property is inherited and setting it to false would break the layout. About the issue with the changed size of the gallery element, I am only able to observe it if the MinSize property of the element is set. The MinSize property is also used internally by the GalleryElement and it is set to an empty size when the popup closes. This forces an update in the layout and as seen in your screenshot the size of the element is decreased to fit the two gallery items. In case you are having only the two items and you want the element to have a size only to fit them, do not set the MinSize property. If you want the element to have some extra space, you will need to asynchronously set the property every time the popup closes: 
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
    {
        public RadForm1()
        {
            InitializeComponent();
     
            this.radGalleryElement1.MinSize = new Size(500, 0);
     
            // Set up the gallery
     
            this.radGalleryElement1.DropDownClosed += this.RadGalleryElement1_DropDownClosed;
        }
     
        private void RadGalleryElement1_DropDownClosed(object sender, RadPopupClosedEventArgs args)
        {
            Timer timer = new Timer();
            timer.Interval = 10;
            timer.Tick += (t, ev) =>
            {
                timer.Enabled = false;
                this.radGalleryElement1.MinSize = new Size(500, 0);
            };
     
            timer.Enabled = true;
        }
    }

    Regarding the selected state, indeed some themes are missing it. I have logged a feedback item on your behalf, here: RadRibbonBar - the Windows 8 theme is missing the IsSelected state set on the RadGalleryItem. I have also updated your Telerik points. A possible workaround is to change the theme in the VSB tool. In order to have the IsSelected state applied it is also necessary to set the ItemSelection property of the gallery element to true:
    this.radGalleryElement1.ItemSelection = true;

    I am also attaching my test project including a custom theme with the applied missing state. I hope this will help.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top