代码之家  ›  专栏  ›  技术社区  ›  Bassie

如何设置默认导航UI的样式

  •  2
  • Bassie  · 技术社区  · 7 年前

    我正在使用一个 框架 在一个 窗口中显示内容,我添加了导航

    <frame navigationuivisibility=“visible”name=“framecontent”verticalalightment=“stretch”margin=“0,34,-0.8,0.4”grid.rowspan=“2”/>gt;
    < /代码> 
    
    

    window.xsml.cs中

    framecontent.navigate(new homeview());
    < /代码> 
    
    

    导航栏如下所示:

    是否有任何方法可以更改此栏的默认外观?还是创建一个新的选项?

    而在Window.xsml.cs

    FrameContent.Navigate(new HomeView());
    

    导航栏如下:

    enter image description here

    是否有任何方法可以更改此栏的默认外观?还是创建一个新的选项?

    1 回复  |  直到 7 年前
        1
  •  2
  •   Nehorai Elbaz    7 年前

    在我的WPF应用程序中,我创建了自己的,最简单的版本如下:

    <Grid VerticalAlignment="Top" Height="50" Background="DarkGray">
        <StackPanel Orientation="Horizontal">
             <Button Content="Back" Click="Back_Btn"/>
             <Button Content="Next" Click="Next_Btn"/>
         </StackPanel>
    </Grid>
    

    代码背后:

    private void Next_Btn(object sender, RoutedEventArgs e)
    {
       if (this.NavigationService.CanGoForward)
           NavigationService.GoForward();
        else
            NavigationService.Navigate(new HomeView());
    }
    
    private void Back_Btn(object sender, RoutedEventArgs e)
    {
        if (this.NavigationService.CanGoBack)
            NavigationService.GoBack();
        else
            NavigationService.Navigate(new HomeView());
    }
    

    如果需要,可以用 materialdesign 例如,nuget的包。

    它的MVVM版本更加复杂。