x:Static 扩展在 WinRT-XAML 中工作吗? [英] Do x:Static extensions work in WinRT-XAML?
问题描述
这是本主题的继续:禁用所选列表视图项 2 的蓝色边框
我想在适用于 Windows 8.1 的应用程序中执行此操作:
I wanted to do this in app for Windows 8.1:
<ListView x:Name="gui_listView" HorizontalAlignment="Left"
Height="610" Margin="48,54,0,0" VerticalAlignment="Top"
Width="256" SelectionChanged="gui_listView_SelectionChanged"
SelectionMode="Extended">
<ListView.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="Transparent"/>
</ListView.Resources>
</ListView>
但微软可能终止了对静态扩展的支持.有人知道我现在应该做什么吗?有错误的图片,我得到了什么.http://imagizer.imageshack.us/a/img835/4764/jlcc9.jpg
But microsoft probably ended support for static extension's. Anybody know what i should do now? There is picture of errors, what i got. http://imagizer.imageshack.us/a/img835/4764/jlcc9.jpg
感谢您的回复.
推荐答案
由于您在问题中提出了两个问题,因此我将提供两个答案.要移除鼠标悬停效果,您需要覆盖主题值.您在 app.xaml 中执行此操作.
Since you asked two questions in your question, I will provide both answers. To remove the mouse over effect, you need to override the theme value. You do this in app.xaml.
<Application
x:Class="App41.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App41">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="ListViewItemPointerOverBackgroundThemeBrush" Color="Transparent" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
这是嵌入在样式本身中的整个列表:
Here's the whole list embedded in the style itself:
<ListViewItemPresenter
CheckHintBrush="{ThemeResource ListViewItemCheckHintThemeBrush}"
CheckBrush="{ThemeResource ListViewItemCheckThemeBrush}"
ContentMargin="4"
ContentTransitions="{TemplateBinding ContentTransitions}"
CheckSelectingBrush="{ThemeResource ListViewItemCheckSelectingThemeBrush}"
DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}"
DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}"
DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}"
DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}"
FocusBorderBrush="{ThemeResource ListViewItemFocusBorderThemeBrush}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Padding="{TemplateBinding Padding}" PointerOverBackgroundMargin="1"
PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}"
PointerOverBackground="{ThemeResource ListViewItemPointerOverBackgroundThemeBrush}"
ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}"
SelectedPointerOverBorderBrush="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}"
SelectionCheckMarkVisualEnabled="True"
SelectedForeground="{ThemeResource ListViewItemSelectedForegroundThemeBrush}"
SelectedPointerOverBackground="{ThemeResource ListViewItemSelectedPointerOverBackgroundThemeBrush}"
SelectedBorderThickness="{ThemeResource ListViewItemCompactSelectedBorderThemeThickness}"
SelectedBackground="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
祝你好运!
这篇关于x:Static 扩展在 WinRT-XAML 中工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!