0

我在 SemanticZoom.ZoomedOutView 中有一个 GridView,在 SemanticZoom.ZoomedInView 中有一个 ListView。我要求单击缩小视图(GridView)中的项目时,放大视图不会显示,而是激活与单击放大视图中的项目时相同的视图。我已经按照此处的说明解决了这个问题,该说明使用实现 ISemanticZoomInformation 的自定义网格。

现在我还需要同步 GridView 和 ListView 以便显示的项目是相同的,只是格式不同。实现这一目标的最佳方法是什么?

到目前为止,我已经尝试获取视图的滚动位置,但我还没有弄清楚如何才能获得显示器上可见的第一个项目,以便我可以使另一个视图显示相同的项目位置。

这是两个语义缩放视图的 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>

这是语义网格:

    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)
    {
    }
}

}

4

0 回答 0