我在哪里可以找到NavigationViewSelectionIndicatorForeground文档? [英] Where do I find NavigationViewSelectionIndicatorForeground Docs?

查看:90
本文介绍了我在哪里可以找到NavigationViewSelectionIndicatorForeground文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定这是一个愚蠢的问题,但是你在哪里可以找到关于NavigationView SelectionIndicator的信息?我在文档中找不到任何关于它的信息,虽然我知道我可以更改指标的颜色,但我希望有更多的信息可以自定义
多一点。我看到人们在回答的问题中引用它,但他们从不提供链接。

I'm sure this is a dumb question, but where do you find info on NavigationView SelectionIndicator? I can't find any info on it in the docs, and while I know I can change the color of the indicator I would like more information on it to possibly customize it a little more. I see people referencing it in answered questions, but they never provide a link.

推荐答案

嗯,您正在寻找的NavigationView SelectionIndicator实际上是NavigationViewItemPresenter模板中的一个矩形。如果你需要修改它,你可以打开generic.xaml文件(选择一个系统资源,如ApplicationPageBackgroundThemeBrush
然后按F12),搜索SelectionIndicator,你会看到名为'SelectionIndicator'的矩形。您可以复制NavigationViewItemPresenter的样式并在xaml文件中使用它,然后您可以像
想要的那样修改SelectionIndicator。

Well, the NavigationView SelectionIndicator you are looking for is actually a rectangle in the template of NavigationViewItemPresenter. If you need to modify this, you could open the generic.xaml file(select a system resource like ApplicationPageBackgroundThemeBrush then press F12), search for SelectionIndicator and you will see the Rectangle called 'SelectionIndicator'. You could copy the style of NavigationViewItemPresenter and use it in your xaml file then you could modify the SelectionIndicator as you want.

    <Style TargetType="NavigationViewItemPresenter" x:Name="NavigationViewItemPresenterStyleWhenOnTopPane">
                     ......
                        
                        <Rectangle 
                            x:Name="PointerRectangle" 
                            Fill="Transparent"
                            Visibility="Collapsed" />
                        <Grid x:Name="ContentGrid">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Viewbox 
                                x:Name="IconBox" 
                                Height="16"
                                Width="16"
                                Margin="16,0,0,0"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center">
                                <ContentPresenter 
                                    x:Name="Icon" 
                                    Content="{TemplateBinding Icon}"
                                    Foreground="{ThemeResource TopNavigationViewItemForeground}" />
                            </Viewbox>
                            <ContentPresenter
                                x:Name="ContentPresenter"
                                Grid.Column="1"
                                Margin="8,0,16,0"
                                Foreground="{ThemeResource TopNavigationViewItemForeground}"
                                TextWrapping="NoWrap"
                                ContentTransitions="{TemplateBinding ContentTransitions}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                Content="{TemplateBinding Content}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                VerticalAlignment="Center"
                                AutomationProperties.AccessibilityView="Raw"/>

                        </Grid>
                        <Grid 
                            x:Name="SelectionIndicatorGrid"
                            Margin="16,0,16,4"
                            VerticalAlignment="Bottom">
                            <Rectangle
                                x:Name="SelectionIndicator"
                                Height="2"
                                Fill="{ThemeResource NavigationViewSelectionIndicatorForeground}"
                                Opacity="0" />

                        </Grid>

                    </Grid>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

祝你好运,

Roy


这篇关于我在哪里可以找到NavigationViewSelectionIndicatorForeground文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆