@wankr guided me in the right direction though his link didn't fully helped me.
I wanted to access an Image to change the displayed source on a timer base.
This is what my OnTick contains to get the Image reference:
ImageSourceConverter converter = new ImageSourceConverter();
PanoramaItem myPanoramaItem = (PanoramaItem)(AppPanorama.ItemContainerGenerator.ContainerFromItem(AppPanorama.Items[_selectedIndex]));
Image galleryItem = (Image)FindVisualChild<Image>("GalleryPreview", myPanoramaItem);
galleryItem.Source = (ImageSource)converter.ConvertFromString(gallery[_galleryIndex]);
"GalleryPreview" is the name of the Image I want to access. As I have multiple Images in my layout, I needed to extend the method FindVisualChild
I found on the link from @wankr.
public static ChildItem FindVisualChild<ChildItem>(String name, DependencyObject obj) where ChildItem : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
FrameworkElement uiChild = (FrameworkElement)child;
if (child != null && child is ChildItem && uiChild.Name.Equals(name))
{
return (ChildItem)child;
}
else
{
ChildItem childOfChild = FindVisualChild<ChildItem>(name, child);
if (childOfChild != null)
{
return childOfChild;
}
}
}
return null;
}