Add control in TabItem programatically

Jun 23 2014 4:43 AM
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:)
 
 

Answers (2)