4
我的Windows Store應用程序中有一個ListView。我希望它成爲一個靜態列表(我使用它是因爲它支持虛擬化,但如果我應該使用其他的東西,請告訴我!)。我設法通過鼠標懸停等方式禁用了大部分UI更改。但是,我還沒有想到如何做的一件事是刪除點擊行爲。當你點擊一個項目時,它會縮小一點,以反饋它已被點擊的信息。我該如何解決這個問題?ListView - 禁用鼠標停止行爲
這裏是我的ListView的XAML:
<ListView x:Name="SlideStrip"
SelectionMode="None"
ScrollViewer.HorizontalScrollMode="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ItemContainerStyle="{StaticResource PlainOldList}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<local:PDFPageUserControl
Margin="0 0 5 0"
ViewModel="{Binding}"
RespectRenderingDimension="Vertical" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
的PlainOldList風格如下:
<Style x:Key="PlainOldList" TargetType="ListViewItem">
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TabNavigation" Value="Local"/>
<Setter Property="IsHoldingEnabled" Value="True"/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<ListViewItemPresenter x:Name="listViewItemPresenter"
CheckHintBrush="{ThemeResource ListViewItemCheckHintThemeBrush}"
CheckBrush="{ThemeResource ListViewItemCheckThemeBrush}"
ContentMargin="0"
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="0"
PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}"
ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}"
SelectedPointerOverBorderBrush="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}"
SelectionCheckMarkVisualEnabled="True"
SelectedForeground="{ThemeResource ListViewItemSelectedForegroundThemeBrush}"
SelectedPointerOverBackground="{ThemeResource ListViewItemSelectedPointerOverBackgroundThemeBrush}"
SelectedBorderThickness="{ThemeResource ListViewItemCompactSelectedBorderThemeThickness}"
SelectedBackground="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}">
</ListViewItemPresenter>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
我敢相信什麼,我需要做的就是編輯可視狀態的項容器樣式。但是對於什麼樣的視覺狀態我完全喪失了。在混合中單擊它們從不顯示活動的轉換。我試圖設置一個或兩個顯式爲零,但失敗(可能是因爲我不知道如何覆蓋默認行爲或選擇錯誤的狀態)。
任何幫助表示讚賞!
不錯!謝謝!!似乎工作。將在進一步測試後報告! – Gordon