我需要一些Windows應用商店8.1中Listview的專家幫助。目前我在ListView中顯示150個項目垂直,使用默認屬性設置爲啓用像Windows Store問題ListView控件
IsSwipeEnabled = 「真」 IsTapEnabled = 「真」 的SelectionMode = 「單」 CanDragItems = 「真」 CanReorderItems = 「真」
使用上面的設置,一切都很好, 當屏幕加載時,我看到默認情況下選擇listview中的第一項是如何刪除默認選擇。我設置seletedindex = -1和selecteditem = null,nuthing已經工作。
當我設置SelectionMode =「無」IsTapEnabled =假和IsItemClickEnabled =「真」然後 我看不到第一個項目被選中。但現在我觸摸事件沒有發射。
第二個問題是我的列表查看項目是可拖動的,每當我選擇/點擊一個項目並拖動到網格的右側時。我的整個列表視圖浮動或移動,我想使Listview固定在位置,當我拖動單個ListViewItem時,不應該拖動整個列表視圖。這對用戶造成了麻煩。我希望listview被固定,即它不應該移動@時間項目被選中和拖動。請提供一些關於此的建議。
<SemanticZoom x:Name="semanticZoom" VerticalAlignment="Bottom" Grid.Row="4" HorizontalAlignment="Left" Style="{x:Null}"
>
<SemanticZoom.ZoomedOutView>
<GridView IsItemClickEnabled="False" IsSwipeEnabled="False" ScrollViewer.IsHorizontalScrollChainingEnabled="False" Style="{x:Null}">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid ItemWidth="75" Orientation="Horizontal" ItemHeight="75" MaximumRowsOrColumns="5" Background="Transparent" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
<ListView x:Name="ItemsGridView" IsSwipeEnabled="True" SelectionMode="Single" IsTapEnabled="True" VerticalAlignment="Stretch" MaxHeight="725"
ItemsSource="{Binding Source={StaticResource GrpColumns},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Height="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" AllowDrop="True" Drop="ItemsGridView_Drop"
Tag="{Binding Path=Columns,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ScrollViewer.VerticalScrollMode="Auto" CanDragItems="True" CanReorderItems="True" IsItemClickEnabled="True" >
<interactivity:Interaction.Behaviors>
<behaviors:DragBehaviour/>
</interactivity:Interaction.Behaviors>
<ListView.ItemTemplate>
<DataTemplate>
<Grid Margin="10,2,0,2" HorizontalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="97*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="{StaticResource AsterikGlyph}"
Style="{StaticResource GlyphIconStyle}" Margin="0,2,0,0"
FontFamily="{StaticResource SymbolThemeFontFamily}"
HorizontalAlignment="Center" VerticalAlignment="Top"
Visibility="{Binding Path=IsRequireField,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource TextBlockVisibityConverter}}" />
<TextBlock Text="{Binding SrcName}" TextTrimming="WordEllipsis" Margin="2,0,0,2" TextWrapping="NoWrap"
Style="{StaticResource SemantizZoomOutViewTextBlock}" Grid.Column="1" ToolTipService.ToolTip="{Binding SrcName}"
VerticalAlignment="Center" HorizontalAlignment="Left">
</TextBlock>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Vertical" VirtualizingStackPanel.VirtualizationMode="Standard" />
</ItemsPanelTemplate>
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<Border Background="#333F50" Margin="4" BorderBrush="Transparent" BorderThickness="1" Width="60" Height="60">
<Button x:Name="HeaderButton" Background="Transparent" Width="60" Height="60" Padding="1" HorizontalAlignment="Center" VerticalAlignment="Center" Click="HeaderButton_Click">
<TextBlock Text="{Binding Key}" Margin="2" Style="{StaticResource GroupHeaderTextStyle}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Button>
</Border>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListView.GroupStyle>
</ListView>
</SemanticZoom.ZoomedInView>
</SemanticZoom>
請檢查答案或給我們添加更多幫助 – Krekkon