none
SemanticZoom.ZoomedOutView如何绑定数据 RRS feed

  • 问题

  • (semanticZoom.ZoomedOutView as ListViewBase).ItemsSource = gridViewData.View.CollectionGroups;

    这样写能够正常显示且定位的,但我现在的数据是异步请求的,想通过绑定的方式来加载数据

    <Page.Resources>
            <CollectionViewSource x:Name="gridViewData" Source="{Binding BrandData}" IsSourceGrouped="true" />

    </Page.Resources>

     <SemanticZoom.ZoomedOutView>
                            <GridView  ScrollViewer.IsHorizontalScrollChainingEnabled="True" ItemsSource="{Binding BrandData}">
                                <GridView.ItemTemplate>
                                    <DataTemplate>
                                        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Margin="10">
                                            <TextBlock Text="{Binding Key}" Foreground="Black" FontSize="25" />
                                        </Grid>
                                    </DataTemplate>
                                </GridView.ItemTemplate>
                                <GridView.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapGrid ItemWidth="75" ItemHeight="75" MaximumRowsOrColumns="1" VerticalChildrenAlignment="Center" />
                                    </ItemsPanelTemplate>
                                </GridView.ItemsPanel>                            
                            </GridView>
                        </SemanticZoom.ZoomedOutView

    ……………………

    这样绑定数据能够显视,却不能够准确的定位,请问各位该如何做?

    2012年9月4日 3:57

答案

  •     <Page.Resources>
            <CollectionViewSource x:Name="source" IsSourceGrouped="True" ItemsPath="Items"/>
        </Page.Resources>
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <SemanticZoom x:Name="semanticZoom">
                <SemanticZoom.ZoomedOutView>
                    <GridView ItemsSource="{Binding CollectionGroups,Source={StaticResource source}}">
    ....

    然后同样ZoomedInView的GridView也绑定这个CollectionViewSource,
                <SemanticZoom.ZoomedInView>
                    <GridView ItemsSource="{Binding Source={StaticResource source}}">
    ....


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    2012年9月4日 8:31
    版主