简体   繁体   中英

Wpf navigation frame inside a frame, navigation button are disabled in child

I have into solution

  1. (A) wpf user control project (library dll): this has an user control which has a frame, own navigation buttons and a menu to navigate between some Pages which are also defined in this project.
  2. (B) wpf application (test): I used to test the dll. It has only a main window which has uses the user control defined in the previous project.
  3. (C) wpf application (let's say the final project) which is more complex. This has also a frame with own navigation button and own menu. The frame has to show several pages defined in this project and also the user control of A.

When I use (B) to test (A) everything works fine. When I use (C) to show (A) the navigation button of A are disabled, and instead the navigation button of C works for pages of A and C.

It looks that the all the commands sent to the frame of C are instead sent to the parent frame of A.

How is it possible?

I have my navigation button with custom UIRoutedCommand

private void Backward_CanExecute(object sender, CanExecuteRoutedEventArgs e)
    {
        e.CanExecute = ChildFrame?.CanGoBack??false;
        e.Handled = true;
    }

ChildFrame?.CanGoBack is always false when A is used by C.

Maybe I wrote the question too fast, instead of read MSDN documentation...

<Frame x:Name="ChildFrame" NavigationUIVisibility="Hidden" JournalOwnership="OwnsJournal">

JournalOwnership="OwnsJournal" saved my day

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM