在失去焦点后保持ListViewItem突出显示

在失去焦点后保持ListViewItem突出显示

本文介绍了在失去焦点后保持ListViewItem突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





想知道如何在将焦点移动到另一个控件后突出显示ListViewItem。



现在我通过在选择项目时设置新的ControlTemplate来改变项目的外观。

对我来说,在WinForms控件中有一个名为ListView.HideSelection的属性。有没有办法在WPF中做到这一点???



无法想象它是那么难,虽然我没有用谷歌搜索到任何地方:((



谢谢

Hi,

wondering how to keep a ListViewItem highlighted after moving focus to another control.

Right now I am changig the appearance of the item by setting a new ControlTemplate when the Item is selected.
Seems to me, there was a property called ListView.HideSelection in the WinForms control. Is there a way to do that in WPF as well???

Can't imagine it is that hard, though I am not getting anywhere with googling :((

Thanks

推荐答案

<MultiTrigger>
                    <MultiTrigger.Conditions>
                        <Condition Property="Selector.IsSelected" Value="True">

                        </Condition>
                        <Condition Property="Selector.IsSelectionActive" Value="False">
                        </Condition>
                    </MultiTrigger.Conditions>
                  -------set the template here too---


<listview>
  <listview.resources>
    <solidcolorbrush x:key="{x:Static SystemColors.ControlBrushKey}" xmlns:x="#unknown">
        Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}"/>
  </solidcolorbrush></listview.resources>
</listview>



这篇关于在失去焦点后保持ListViewItem突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 22:44