UWP change NavigationViewItem height

余生颓废 提交于 2019-12-11 18:04:57

问题


On the image above, you can see my app (left) and Groove Player (right). I want to make NavigationViewItem height big like Groove Player, but I don't know how. I tried playing with Padding and MinHeight but it doesn't look the same.

I want to do the same for the AutoSuggestBox and the Settings button, that are part of NavigationView.

    <NavigationView x:Name="navView" IsSettingsVisible="True">
        <NavigationView.AutoSuggestBox>
            <AutoSuggestBox QueryIcon="Find" PlaceholderText="Search"></AutoSuggestBox>
        </NavigationView.AutoSuggestBox>

        <NavigationView.MenuItems>
            <NavigationViewItem x:Name="button1" Icon="Favorite" Content="Button 1" Tapped="Button1_Tapped"/>
            <NavigationViewItem x:Name="button2" Icon="Save" Content="Button 2" Tapped="Button2_Tapped"/>
        </NavigationView.MenuItems>
    </NavigationView>

回答1:


UWP change NavigationViewItem height

For your requirement, you could edit NavigationViewItem template. Right click NavigationViewItem in the xaml designer -> Edit Template -> Edit a copy.

If you want to change NavigationViewItem height, you could modify LayoutRoot height. And then modify SelectionIndicator height correspondingly.

<Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}" Height="50" Control.IsTemplateFocusTarget="True">
 ......
<Rectangle x:Name="SelectionIndicator" Fill="{ThemeResource NavigationViewSelectionIndicatorForeground}" Height="40" Opacity="0.0" Width="6"/>


来源:https://stackoverflow.com/questions/47776746/uwp-change-navigationviewitem-height

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!