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

    <tfoot id='YzJ7Y'></tfoot>
      <bdo id='YzJ7Y'></bdo><ul id='YzJ7Y'></ul>

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

    1. <legend id='YzJ7Y'><style id='YzJ7Y'><dir id='YzJ7Y'><q id='YzJ7Y'></q></dir></style></legend>

        ListBox 和 ListView 突出显示 .NET 4.0

        时间:2023-10-07
            <tbody id='pDhCE'></tbody>
        • <i id='pDhCE'><tr id='pDhCE'><dt id='pDhCE'><q id='pDhCE'><span id='pDhCE'><b id='pDhCE'><form id='pDhCE'><ins id='pDhCE'></ins><ul id='pDhCE'></ul><sub id='pDhCE'></sub></form><legend id='pDhCE'></legend><bdo id='pDhCE'><pre id='pDhCE'><center id='pDhCE'></center></pre></bdo></b><th id='pDhCE'></th></span></q></dt></tr></i><div id='pDhCE'><tfoot id='pDhCE'></tfoot><dl id='pDhCE'><fieldset id='pDhCE'></fieldset></dl></div>

          <legend id='pDhCE'><style id='pDhCE'><dir id='pDhCE'><q id='pDhCE'></q></dir></style></legend>

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

                  <bdo id='pDhCE'></bdo><ul id='pDhCE'></ul>
                  <tfoot id='pDhCE'></tfoot>
                  本文介绍了ListBox 和 ListView 突出显示 .NET 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 .NET 4.0 中,ListBox 和 ListView 的高亮显示发生了变化

                  With .NET 4.0 it appears highlighting of ListBox and ListView has changed

                  下面是我多年来在 .NET 3.5 的几个地方使用的代码,当不专注时突出显示已停止在 4.0 和 4.5 上工作

                  Below is code I have used for years in several places on .NET 3.5 and highlight when not focused has stopped working on 4.0 and 4.5

                  <ListBox.ItemContainerStyle>
                      <Style>
                          <Style.Resources>
                              <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Red"/>
                              <!-- Background of selected item when focussed -->
                              <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Pink"/>
                              <!-- Background of selected item when not focussed -->
                              <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Yellow" />
                          </Style.Resources>
                      </Style>
                  </ListBox.ItemContainerStyle>
                  

                  ListBox SelectedItem 背景

                  推荐答案

                  在 .NET 4.0 中有一些新的 SytemColors
                  这似乎是 .NET 4.0 的方式根据评论,这在 4.5 中发生了变化 - 而不是 4.0.

                  With .NET 4.0 there are some new SytemColors
                  This appears to be the .NET 4.0 way According to comment this changed in 4.5 - not 4.0.

                  <ListBox.ItemContainerStyle>
                      <Style>
                          <Style.Resources>
                              <!-- Foregroud of selected item when focussed -->
                              <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Red"/>
                              <!-- Foregroud of selected item when not focussed -->
                              <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Green"/>
                              <!-- Background of selected item when focussed -->
                              <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Pink"/>
                              <!-- Background of selected item when not focussed -->
                              <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Yellow" />
                          </Style.Resources>
                      </Style>
                  </ListBox.ItemContainerStyle> 
                  

                  一开始我虽然 ControlBrushKey 的定义变了但是没有变
                  在这种情况下,ControlBrushKey 的行为似乎发生了变化

                  At first I though the definition of ControlBrushKey had changed but it has not
                  It appears the behavior of ControlBrushKey has changed in this situation

                  注意 GridView 的行为变化

                  这篇关于ListBox 和 ListView 突出显示 .NET 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 C# 中通过代码设置列表框项的字体和颜色 下一篇:展开 ListBox 中的选定项高度

                  相关文章

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

                    1. <small id='svnHO'></small><noframes id='svnHO'>

                      <tfoot id='svnHO'></tfoot>
                        <bdo id='svnHO'></bdo><ul id='svnHO'></ul>

                      <legend id='svnHO'><style id='svnHO'><dir id='svnHO'><q id='svnHO'></q></dir></style></legend>