Hello All,
I have generally one question - my target is to random select picture from my resources and add it as image source to image control for each tabitem I have in TabControl. Random generate index with my table contains pictures I already have and It works. But my main problem is that how I can do it in C# (not by XAML) becouse I don't want to create image control in Visual Studio, I prefer do it in runtime code.
Every TabItem contains Grid control, and exactly in this Grid control I want to add picture - how it's possible? I need to iterate by every TabItem, and then every Grid?
I tried simple way, but it's not proper way I suppose:/
foreach (TabItem tab in TabControl)
{
}
Is this possible somehow?:)
Thanks for any help:)
michal adamkiewiczPosted Jun 23, 2014, 7:41 AM
Hmmm
Sivaraman DhamodaranPosted Jun 23, 2014, 5:50 AM
foreach (TabPage page in MyTabCtrl.TabPages)
{
Control.ControlCollection ctrls = page.Controls;
foreach (Control contrl in ctrls )
{
//Do your stuff here
//page is a tab page [Iterated one by one]
//contrl is control on each page (Iterate one by one for each page)
}
}
Hope this helps