3

我在语义缩放控件中嵌入了一个 ListView 控件:

<SemanticZoom x:Name="diarySemanticZoom" Grid.Row="1">
            <SemanticZoom.ZoomedOutView>
                <GridView>
                    ...
                </GridView>
            </SemanticZoom.ZoomedOutView>
            <SemanticZoom.ZoomedInView>
                    <ListView 
                        x:Name="diaryListView" 
                        AutomationProperties.AutomationId="diaryListView"
                        AutomationProperties.Name="Grouped Items"
                        Grid.Row="1" 
                        ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
                        SelectionMode="Single" 
                        ScrollViewer.IsHorizontalScrollChainingEnabled="False"
                        ScrollViewer.IsVerticalScrollChainingEnabled="False"
                        ScrollViewer.HorizontalScrollBarVisibility="Visible"
                        >
                        <ListView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapGrid Orientation="Vertical" 
                                MaximumRowsOrColumns="1" x:Name="insideWrapGrid"/>
                        </ItemsPanelTemplate> ...

当 XAML 加载时,我想滚动到 Listview 内的项目

protected override void LoadState(Object navigationParameter, 
                     Dictionary<String, Object> pageState)
{
    var diaryDaysModel = DiaryDays.DiaryDayList;
    /* Group the days */
    var daysViewModelGroup = from ddm in diaryDaysModel
                             group ddm by new { ddm.MonthName, ddm.DayNo } into grp
                             orderby grp.Key.DayNo
                             select new { Key = grp.Key, Items = grp };

    itemsViewSource.Source = daysViewModelGroup;
    diaryListView.SelectedIndex = 5;
    var zoomLoc = new SemanticZoomLocation() { Item = diaryListView.SelectedItem };
    diarySemanticZoom.ZoomedInView.MakeVisible(zoomLoc);
    diaryListView.MakeVisible(zoomLoc);

}

到目前为止我已经尝试了很多选项,但似乎没有一个可以移动滚动

4

1 回答 1

1

您应该可以滚动。如果要垂直滚动,请编辑 ScrollViewer.IsVerticalScrollBarEnabled="Enabled"。

于 2013-01-12T21:31:10.897 回答