如何在WPF框架中更改导航栏上的属性?

时间:2009-05-11 00:52:02

标签: wpf

我正在开发基于页面的WPF应用程序,我想更改框架中导航栏的大小。我设置了NavigationUIVisibility =“Visible”以查看导航栏,现在我如何更改导航栏上的属性,就像它的大小一样?

谢谢,
罗伊

2 个答案:

答案 0 :(得分:3)

导航栏很难改变。我建议你创建自己的。 创建自己的按钮,然后使用

myFrame.NavigationService.GoBack()
myFrame.NavigationService.GoForward()

示例:

Private Sub PreviousPageCommand_Executed(ByVal sender As Object, _
                                     ByVal e As ExecutedRoutedEventArgs)
    MainFrame.NavigationService.GoBack()
End Sub

Private Sub PreviousPageCommand_CanExecute(ByVal sender As Object, _
                            ByVal e As CanExecuteRoutedEventArgs)
    If Not MainFrame Is Nothing Then
        e.CanExecute = MainFrame.NavigationService.CanGoBack
    Else
        e.CanExecute = False
    End If
End Sub

Private Sub NextPageCommand_Executed(ByVal sender As Object, _
                                     ByVal e As ExecutedRoutedEventArgs)
    MainFrame.NavigationService.GoForward()
End Sub

Private Sub NextPageCommand_CanExecute(ByVal sender As Object, _
                                    ByVal e As CanExecuteRoutedEventArgs)
    If Not MainFrame Is Nothing Then
        e.CanExecute = MainFrame.NavigationService.CanGoForward
    Else
        e.CanExecute = False
    End If
End Sub

答案 1 :(得分:0)

有一种方法可以操作默认样式菜单

Sample

上面链接了一个示例项目,您不仅可以看到导航菜单,还可以看到其他控件。

您基本上创建了一个替换默认值的样式资源。他们给你的例子是一个很好的开始。然后你可以调整资源以获得你想要的外观。

相关问题