<small id='tB2xQ'></small><noframes id='tB2xQ'>

    <i id='tB2xQ'><tr id='tB2xQ'><dt id='tB2xQ'><q id='tB2xQ'><span id='tB2xQ'><b id='tB2xQ'><form id='tB2xQ'><ins id='tB2xQ'></ins><ul id='tB2xQ'></ul><sub id='tB2xQ'></sub></form><legend id='tB2xQ'></legend><bdo id='tB2xQ'><pre id='tB2xQ'><center id='tB2xQ'></center></pre></bdo></b><th id='tB2xQ'></th></span></q></dt></tr></i><div id='tB2xQ'><tfoot id='tB2xQ'></tfoot><dl id='tB2xQ'><fieldset id='tB2xQ'></fieldset></dl></div>
    1. <legend id='tB2xQ'><style id='tB2xQ'><dir id='tB2xQ'><q id='tB2xQ'></q></dir></style></legend>
        <bdo id='tB2xQ'></bdo><ul id='tB2xQ'></ul>
        <tfoot id='tB2xQ'></tfoot>
      1. 如何更改 UWP 中选定 ListView 项的突出显示颜色(Windows 10)

        时间:2023-09-15
          <bdo id='JgXlX'></bdo><ul id='JgXlX'></ul>
            <tbody id='JgXlX'></tbody>
          1. <legend id='JgXlX'><style id='JgXlX'><dir id='JgXlX'><q id='JgXlX'></q></dir></style></legend>
              <tfoot id='JgXlX'></tfoot>

              <small id='JgXlX'></small><noframes id='JgXlX'>

                  <i id='JgXlX'><tr id='JgXlX'><dt id='JgXlX'><q id='JgXlX'><span id='JgXlX'><b id='JgXlX'><form id='JgXlX'><ins id='JgXlX'></ins><ul id='JgXlX'></ul><sub id='JgXlX'></sub></form><legend id='JgXlX'></legend><bdo id='JgXlX'><pre id='JgXlX'><center id='JgXlX'></center></pre></bdo></b><th id='JgXlX'></th></span></q></dt></tr></i><div id='JgXlX'><tfoot id='JgXlX'></tfoot><dl id='JgXlX'><fieldset id='JgXlX'></fieldset></dl></div>

                  本文介绍了如何更改 UWP 中选定 ListView 项的突出显示颜色(Windows 10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 C# 和 XAML 开发 Windows 10 应用程序.我有一个 ListView,我想更改所选项目的默认 HighLight 颜色.我看到了许多代码示例(例如 this) 但都是为 WP8 或 Win8 设计的,我试图实现这些但它们对我不起作用.

                  I'm working on a Windows 10 app using C# and XAML. I have a ListView and I want to change the default HighLight color of an selected item. I was seeing many code examples (like this) but all are designed for WP8 or Win8, I was trying to implement those but they do not work for me.

                  一般来说,我在修改控件的默认主题时遇到了麻烦,因为我找不到有用的文档.如果有人可以帮助我处理高亮颜色并推荐我好的文档,那就太好了.

                  In general I'm having troubles modifying the default themes of controls because I don't find useful documentation. It would be great if someone can help me with the highlight color and also recommend me good documentation.

                  推荐答案

                  实际上发现样式属性的更好方法是使用 Blend.

                  Actually a better way to discover the styling properties is to use Blend.

                  首先,在 Blend 中打开您的页面.然后右键单击您的 ListView 并继续

                  First, open up your page in Blend. Then right click on your ListView and go

                  编辑其他模板 > 编辑生成的项目容器 (ItemContainerStyle) > 编辑副本.

                  给它起个名字然后点击OK.

                  Give it a name and hit OK.

                  现在,您已经为 ListViewItem 生成了完整的内置样式,在这里您可以找到有关其外观、动画和其他视觉行为的所有信息.

                  Now, you have generated the full built-in style for your ListViewItems and this is where you can find all the information about their appearance, animations and other visual behaviors.

                  你应该看看这段代码-

                  <ListViewItemPresenter CheckBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" 
                                         ContentMargin="{TemplateBinding Padding}" 
                                         CheckMode="Inline" 
                                         ContentTransitions="{TemplateBinding ContentTransitions}" 
                                         CheckBoxBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" 
                                         DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}" 
                                         DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}" 
                                         DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}" 
                                         DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}" 
                                         FocusBorderBrush="{ThemeResource SystemControlForegroundAltHighBrush}" 
                                         FocusSecondaryBorderBrush="{ThemeResource SystemControlForegroundBaseHighBrush}" 
                                         HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                         PointerOverForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}"
                                         PressedBackground="{ThemeResource SystemControlHighlightListMediumBrush}"
                                         PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}"
                                         PointerOverBackground="{ThemeResource SystemControlHighlightListLowBrush}"
                                         ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" 
                                         SelectedPressedBackground="{ThemeResource SystemControlHighlightListAccentHighBrush}"
                                         SelectionCheckMarkVisualEnabled="True" 
                                         SelectedForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}"
                                         SelectedPointerOverBackground="{ThemeResource SystemControlHighlightListAccentMediumBrush}" 
                                         SelectedBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"
                                         VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                  

                  看到 SelectedBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}" 行了吗?在那里你可以应用你自己的颜色.请记住,它的类型应该是 Brush 而不是 Color.

                  See the line SelectedBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"? That's where you can apply your own color to it. Keep in mind that it should be of type Brush instead of Color.

                  这篇关于如何更改 UWP 中选定 ListView 项的突出显示颜色(Windows 10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:无法加载文件或程序集“Newtonsoft.Json,Version=9.0.0.0,Culture=neutral,P 下一篇:在 Windows 10 中将应用程序注册到 URI 方案

                  相关文章

                • <legend id='jwrBB'><style id='jwrBB'><dir id='jwrBB'><q id='jwrBB'></q></dir></style></legend>
                    • <bdo id='jwrBB'></bdo><ul id='jwrBB'></ul>
                      <tfoot id='jwrBB'></tfoot>
                    1. <small id='jwrBB'></small><noframes id='jwrBB'>

                    2. <i id='jwrBB'><tr id='jwrBB'><dt id='jwrBB'><q id='jwrBB'><span id='jwrBB'><b id='jwrBB'><form id='jwrBB'><ins id='jwrBB'></ins><ul id='jwrBB'></ul><sub id='jwrBB'></sub></form><legend id='jwrBB'></legend><bdo id='jwrBB'><pre id='jwrBB'><center id='jwrBB'></center></pre></bdo></b><th id='jwrBB'></th></span></q></dt></tr></i><div id='jwrBB'><tfoot id='jwrBB'></tfoot><dl id='jwrBB'><fieldset id='jwrBB'></fieldset></dl></div>