Stacking WPF Frame Stack

This seems like an easy solution, but I spend too much time trying to figure it out. Perhaps I am not building the application correctly (which may be so), so please help me if you have a better solution.

I am developing an enterprise-level WPF application that looks like Outlook with Ribbon instead of a toolbar. I have many different modules that load into the frame when the user clicks on the RibbonButton . Keep in mind that his tape is shared across all modules.

So, I have a shell with a ribbon and a frame. When the user clicks the Ribbon button, he loads the appropriate module (usercontrol) into the frame. Things are good. However, if I move to another module (by clicking on another RibbonButton) and then on the original RibbonButton , now I have two instances of the same module ... but only one is displayed in the frame ... the other module is on the frame stack .

So my question is, how can I tell the frame to close usercontrol when I switch to another module? I tried setting JournalEntry.KeepAlive="False" , but it still didn't work. Any thoughts? There is really not much code to publish, but I can do it if it helps you.

+7
wpf mvvm composite-application
source share
1 answer

If you never intend to go back to the previous record, you can use NavigationService.RemoveBackEntry () to clear the history every time you navigate. The easiest way to do this is to handle the Frame Navigated event :

 frame.Navigated += frame_Navigated; void frame_Navigated(object sender, NavigationEventArgs e) { frame.NavigationService.RemoveBackEntry(); } 
+9
source share

All Articles