如果你的意思是禁用所选项目的风格,那么在WPF,你可以这样做:
<Style x:Key="NullSelectionStyle" TargetType="ListBoxItem">
<Style.Resources>
<!-- SelectedItem with focus -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<!-- SelectedItem without focus -->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
<!-- SelectedItem text foreground -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{DynamicResource {x:Static SystemColors.ControlTextColorKey}}" />
</Style.Resources>
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>
<ListBox ItemContainerStyle="{StaticResource NullSelectionStyle}" ...>
不幸的是我没有访问到Windows 8还,所以如果它适用于我不能说WinRT的。
或者,如果你根本不需要任何选择,只需使用ItemsControl即可。
例如,而不是<ListBox .../>
使用<ItemsControl .../>
。一个ItemsControl显示一个像列表框这样的项目列表,但没有选定项目的概念。
谢谢,ItemsControl的似乎工作,但一个项目被点击ItemControl作为一个列表框(并且知道女巫项目选择)? – NicoMinsk 2012-03-12 23:13:43
正如我所说'没有选定项目的概念'。没有ItemsControl没有选定的项目。 – Phil 2012-03-13 06:47:13
好吧,我找到了一个解决方案,带有一个按钮,并且使用bindind标签。 – NicoMinsk 2012-03-13 07:11:52