没有代码隐藏的框架导航

Frame Navigation without code-behind

我正在尝试使用功能区按钮(或常规按钮)创建导航应用程序。当我尝试以下代码时(省略命名空间定义)

<Window ...>
    <StackPanel>
        <Button Command="NavigationCommands.GoToPage" CommandParameter="/Pages/Welcome.xaml" CommandTarget="{Binding ElementName=MainFrame}">Click</Button>
    <Frame x:Name="MainFrame"></Frame>
    </StackPanel>
</Window>

按钮变灰,无法使用。有没有可能在不使用代码隐藏或任何框架的情况下实现这一目标?

Is there anyway possible to achieve this without using code-behind or any framework?

不,我不这么认为,显然只有 DocumentViewerFlowDocumentPageViewer(而不是 Frame)原生支持 NavigationCommands.GoToPagehttps://social.msdn.microsoft.com/Forums/vstudio/en-US/1ff0906f-3847-46fe-8aff-c121e9caf655/how-to-enable-a-navigationcommandsgotopage-command?forum=wpf