没有代码隐藏的帧导航

时间:2017-07-17 12:43:07

标签: wpf xaml navigation frame

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

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

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

1 个答案:

答案 0 :(得分:1)

  

有没有可能在不使用代码隐藏或任何框架的情况下实现这一目标?

不,我不这么认为,显然只有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

相关问题