You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a WinUI3 desktop app with WindowsAppSDK 1.0 and need to change an image in the Content section of a NavigationViewItem dynamically. I have been able to change the image by using a data class that derives from INotifyPropertyChanged where the asset path for the image is changed under program logic. That works OK.
The Content of the item is a simple horizontal StackPanel with these elements: Image1, TextBlock, Image2
Image1 and TextBlock are static; I'm only changing Image2.
But when I change Image2, the entire NavigationViewItem flickers. It seems the entire item layout is being regenerated when Image2 is changed.
I have thought of perhaps using a layout image over the item, but that's kind of kludgy and I'm not clear on how such a layout could be positioned properly. Another idea I thought of was to somehow use storyboarding. Both of these are challenging. Was hoping for something simpler that I hadn't thought of.
This discussion was converted from issue #7039 on July 22, 2022 21:23.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello -
I am building a WinUI3 desktop app with WindowsAppSDK 1.0 and need to change an image in the Content section of a NavigationViewItem dynamically. I have been able to change the image by using a data class that derives from INotifyPropertyChanged where the asset path for the image is changed under program logic. That works OK.
The Content of the item is a simple horizontal StackPanel with these elements: Image1, TextBlock, Image2
Image1 and TextBlock are static; I'm only changing Image2.
But when I change Image2, the entire NavigationViewItem flickers. It seems the entire item layout is being regenerated when Image2 is changed.
I have thought of perhaps using a layout image over the item, but that's kind of kludgy and I'm not clear on how such a layout could be positioned properly. Another idea I thought of was to somehow use storyboarding. Both of these are challenging. Was hoping for something simpler that I hadn't thought of.
Thanks for any suggestions you can provide.
Robert
Beta Was this translation helpful? Give feedback.
All reactions