RadGalleryElement margin/padding issue

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

    Posted 20 Feb 2019 Link to this post


    If I set margin or padding value for a gallery item and then add it in the collection of the gallery items, the margin/padding doesn't work incorrectly (see the attach photo: set_margin_before_addrange).

    But if I add gallery item first, and then set its margin/padding value, it works.

    Could someone tell me why? 

    Thank you by advance.


  2. Answer
    Hristo avatar
    1522 posts

    Posted 21 Feb 2019 Link to this post

    Hello Kun,

    Thank you for writing

    Generally, it should not make a difference. In your first screenshot, it looks like a top Padding has been set only to the first gallery item. On my end applying the padding this initially is the same as iterating the Items collection after calling the AddRange method: 

    RadGalleryItem blueItem1 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery001) { Padding = new Padding(5) };
    RadGalleryItem blueItem2 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery002) { Padding = new Padding(5) };
    RadGalleryItem blueItem3 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery003) { Padding = new Padding(5) };
    RadGalleryItem blueItem4 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery004) { Padding = new Padding(5) };
    RadGalleryItem purpleItem1 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery005) { Padding = new Padding(5) };
    RadGalleryItem purpleItem2 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery006) { Padding = new Padding(5) };
    RadGalleryItem purpleItem3 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery007) { Padding = new Padding(5) };
    RadGalleryItem purpleItem4 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery008) { Padding = new Padding(5) };
    RadGalleryItem greenItem1 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery009) { Padding = new Padding(5) };
    RadGalleryItem greenItem2 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery010) { Padding = new Padding(5) };
    RadGalleryItem greenItem3 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery011) { Padding = new Padding(5) };
    RadGalleryItem greenItem4 = new RadGalleryItem("", Properties.Resources.RibbonBar_GettingStarted_CreatingAGallery012) { Padding = new Padding(5) };
    this.radGalleryElement1.Items.AddRange(blueItem1, blueItem2, blueItem3, blueItem4,
                                            greenItem1, greenItem2, greenItem3, greenItem4,
                                            purpleItem1, purpleItem2, purpleItem3, purpleItem4);

    foreach (RadGalleryItem item in this.radGalleryElement1.Items)
        item.Padding = new Padding(5);

    In case the issue persists, let me know how I can observe it on my end.

    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.
  3. Kun
    Kun avatar
    44 posts
    Member since:
    Aug 2018

    Posted 21 Feb 2019 in reply to Hristo Link to this post

    Thank you Hristo.

    I've tried again with your script. It works great.


Back to Top