SemanticZoom.ZoomedOutView に GridView があり、SemanticZoom.ZoomedInView に ListView があります。ズームアウト ビュー (GridView) でアイテムをクリックすると、ズームイン ビューが表示されず、代わりに、ズームイン ビューでアイテムをクリックしたときと同じビューがアクティブになります。ISemanticZoomInformation を実装するカスタム グリッドを使用するこちらの手順に従って、これを解決しました。
ここで、GridView と ListView を同期する必要もあります。これにより、表示される項目が同じで、形式が異なるだけです。これを達成するための最良の方法は何ですか?
これまでのところ、ビューのスクロール位置を取得しようとしましたが、ディスプレイに表示されている最初のアイテムを取得して、他のビューに同じアイテムの位置を表示させる方法がわかりませんでした。
2 つのセマンティック ズーム ビューの xaml は次のとおりです。
<SemanticZoom x:Name="semanticZoomControl" Grid.Row="2" Grid.ColumnSpan="100" ViewChangeStarted="OnViewChangeStarted" ViewChangeCompleted="OnViewChangedCompleted">
<SemanticZoom.ZoomedInView>
<ListView
x:Name="itemsFullListView"
TabIndex="1"
Grid.Row="2"
ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
ItemTemplate="{StaticResource ItemsListTemplate}"
SelectionMode="Extended"
IsSwipeEnabled="True"
IsItemClickEnabled="True"
ItemClick="OnSelectedItem"
SelectionChanged="itemsFullListView_SelectionChanged">
<ListView.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Description" FontSize="20" FontWeight="Bold" Margin="5 0"/>
</Grid>
</ListView.Header>
</ListView>
</SemanticZoom.ZoomedInView>
<SemanticZoom.ZoomedOutView>
<local:SemanticGrid>
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemsGridView"
AutomationProperties.Name="Items"
TabIndex="1"
Grid.Row="1"
Grid.RowSpan="100"
Grid.ColumnSpan="100"
Padding="30,0,30,0"
ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
ItemTemplate="{StaticResource Standard250x250ItemTemplate}"
SelectionMode="Extended"
IsSwipeEnabled="True"
IsItemClickEnabled="True"
ItemClick="OnSelectedItem"
SelectionChanged="itemGridView_SelectionChanged"
ScrollViewer.IsHorizontalScrollChainingEnabled="False"
/>
</local:SemanticGrid>
</SemanticZoom.ZoomedOutView>
</SemanticZoom>
SemanticGrid は次のとおりです。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
namespace App2
{
public class SemanticGrid: Grid, ISemanticZoomInformation
{
public void CompleteViewChange()
{
}
public void CompleteViewChangeFrom(SemanticZoomLocation source, SemanticZoomLocation destination)
{
}
public void CompleteViewChangeTo(SemanticZoomLocation source, SemanticZoomLocation destination)
{
}
public void InitializeViewChange()
{
}
public bool IsActiveView
{
get;
set;
}
public bool IsZoomedInView
{
get;
set;
}
public void MakeVisible(SemanticZoomLocation item)
{
}
public SemanticZoom SemanticZoomOwner
{
get;
set;
}
public void StartViewChangeFrom(SemanticZoomLocation source, SemanticZoomLocation destination)
{
}
public void StartViewChangeTo(SemanticZoomLocation source, SemanticZoomLocation destination)
{
}
}
}