This is a migrated thread and some comments may be shown as answers.

RadGalleryElement margin/padding issue

2 Answers 16 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Kun
Top achievements
Rank 2
Kun asked on 20 Feb 2019, 11:19 AM

Hello,

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 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 21 Feb 2019, 09:27 AM
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: 

Regards,
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.

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.
0
Kun
Top achievements
Rank 2
answered on 21 Feb 2019, 09:38 AM

Thank you Hristo.

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

Regards,

Tags
RibbonBar
Asked by
Kun
Top achievements
Rank 2
Answers by
Hristo
Telerik team
Kun
Top achievements
Rank 2
Share this question
or