appbar icons won't show up when changing TransitioningContentControl's content
Hi I've an issue with changing TransitioningContentControl content. I've four user controls that have different appbar icons in a rectangle same as here http://mahapps.com/guides/icons-and-resources.html When I change TransitioningContentControl's content to any of these user controls in any other event, their icons won't show up. But when I do it in constructor, I have the icons. Sorry for my bad English xD
So you're using the MahApps.Metro.Resources icon pack, correct? And you have some icons that show up one one UserControl, but when you try to show those same icons on another UserControl they don't appear. Is that correct?
Yeah, thats right. The first UserControl's icon in a TransitioningContentControl is visible, but other UserControls in same TransitioningContentControl wont have any icons.
Had that problem too. The icons in the resource dictionaries are controls. They're also shared, meaning the resource system returns the same instance on every request. A control, however can only occur once in WPF's visual tree, so, the second time it tries to fit in the icon control it will fail because it is already present in the visual tree.
Add the x:Shared="False" attribute to the icons you need in Icons.xaml (or do a Find/Replace and replace every <Canvas with <Canvas x:Shared="False").
That worked! Thank you so much. I had to forget about putting icons on UserControls, but now I can use them
You're welcome.
@punker76 You may close this one.