问题
Edit: This is continue of this topic:Disable blue border for selected Listview item 2
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>
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
Thanks for any response.
回答1:
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}"/>
Best of luck!
回答2:
The fact is x:Static
hasn't stopped working, it never has worked in the Windows Runtime. All binding is to instance objects in Windows Runtime. I realize this is definitely different than WPF. But it is what it is, the easiest workaround is to wrap your static references in your view model.
public static class Information
{
public static string Secret = "8675309";
}
public class MyViewModel
{
public string Secret { get { return Information.Secret; } }
}
Best of luck!
回答3:
Try this:
MSDN ListView styles
put that in your Window
or UC
Resources
tag.
Now locate VisualState
which is responsible for highlighting and change it to your liking.
HTH
P.S. reason why I haven't posted ready solution is because you will benefit more from finding out which part is responsible for highlighting and it will make the development easier.
来源:https://stackoverflow.com/questions/23674526/do-xstatic-extensions-work-in-winrt-xaml