WPF ListView的关闭选择 [英] WPF ListView turn off selection
问题描述
我有一个简单的WPF ListView和一个简单的问题:
是否有可能关闭的选择,因此当用户点击行,行不突出?
我想第1行点击时看起来就像行0。
可能相关:我可以风格悬停/选择的外观?例如。更换蓝色渐变悬停一下(3号线),带有自定义纯色。我发现这和<一个href=\"http://blogs.msdn.com/wpfsdk/archive/2007/08/31/specifying-the-selection-color-content-alignment-and-background-color-for-items-in-a-listbox.aspx\">this,不幸的是没有帮助的。
(殊途同归,不使用的ListView太不可接受的。我只是希望能够使用逻辑滚动和ListView控件不UI虚拟化)
非常感谢你的帮助。
有关的ListView的XAML是:
&LT; ListView控件HEIGHT =280NAME =ListView控件&GT;
&LT; ListView.Resources&GT;
&LT;! - 尝试覆盖选择颜色 - &GT;
&LT;的SolidColorBrush X:键={X:静态SystemColors.HighlightColorKey}
颜色=绿色/&GT;
&LT; /ListView.Resources>
&LT; ListView.View&GT;
&LT;&GridView的GT;
&LT; GridView.Columns&GT;
&LT; GridViewColumn标题=名称DisplayMemberBinding ={绑定名称}/&GT;
&LT;! - 更多的列 - &GT;
&LT; /GridView.Columns>
&LT; / GridView的&GT;
&LT; /ListView.View>
&LT; /&的ListView GT;
我发现的最简单的方法:
&LT; setter属性=调焦VALUE =FALSE/&GT;
I have a simple WPF ListView and a simple question:
Is it possible to turn off the selection, so when user clicks row, the row is not highlighted?
I would like the row 1 to look just like row 0 when clicked.
Possibly related: can I style the look of the hover / selection? Eg. to replace the blue gradient hover look (line 3) with a custom solid color. I have found this and this, unfortunately not helping.
(Achieving the same without using ListView is acceptable too. I'd just like to be able to use logical scrolling and UI virtualization as ListView does)
Thank you very much for your help.
The XAML for ListView is:
<ListView Height="280" Name="listView">
<ListView.Resources>
<!-- attempt to override selection color -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightColorKey}"
Color="Green" />
</ListView.Resources>
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
<!-- more columns -->
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
The easiest way I found:
<Setter Property="Focusable" Value="false"/>
这篇关于WPF ListView的关闭选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!