简体   繁体   English

如何在组合的语义缩放ListView上显示文本?

[英]How do I get Text to Display on a grouped Semantic Zoom ListView?

I'm having a bit of trouble with semantic zooms and grouping listviews, hopefully someone can help me out. 我在语义缩放和对列表视图进行分组时遇到了麻烦,希望有人可以帮助我。

When I go into my ZoomedOutView the grouping is there but it's not displaying any the group text. 当我进入ZoomedOutView时,分组存在,但是没有显示任何分组文本。

Here's my CollectionViewSource 这是我的CollectionViewSource

<CollectionViewSource x:Name="ControlPanelGroup" IsSourceGrouped="True" Source="{Binding HeaderList}"/>

The Semantic Zoom 语义缩放

<SemanticZoom x:Name="semanticZoom" ViewChangeStarted="SemanticZoom_ViewChangeStarted" ScrollViewer.ZoomMode="Enabled"  FocusVisualPrimaryBrush="White" FontFamily="Segoe UI" BorderThickness="0,0,0,0" Margin="0,0,0,10" VerticalAlignment="Stretch">
                                <SemanticZoom.ZoomedOutView>
                                    <ListView x:Name="Headers">
                                        <ListView.ItemTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding HeaderList.Key}" />
                                            </DataTemplate>
                                        </ListView.ItemTemplate>
                                    </ListView>
                                </SemanticZoom.ZoomedOutView>

                                <SemanticZoom.ZoomedInView>
                                    <ListView x:Name="Links" ItemsSource="{Binding Source={StaticResource ControlPanelGroup}}">
                                        <ListView.ItemTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path=Title}"  Margin="25,5,0,5" />
                                            </DataTemplate>
                                        </ListView.ItemTemplate>
                                        <ListView.GroupStyle>
                                            <GroupStyle>
                                                <GroupStyle.HeaderTemplate >
                                                    <DataTemplate>
                                                        <TextBlock Margin="10,5,0,5" Text="{Binding Key}" />
                                                    </DataTemplate>
                                                </GroupStyle.HeaderTemplate>
                                            </GroupStyle>
                                        </ListView.GroupStyle>
                                    </ListView>
                                </SemanticZoom.ZoomedInView>
                            </SemanticZoom>

Loading the Data 加载数据

var HeaderSerializer = new DataContractSerializer(typeof(List<ULSSLinkData>));
        using (var stream = await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync("ControlPanelLinks"))
        {
            HeaderList = (List<ULSSLinkData>)HeaderSerializer.ReadObject(stream);
        }

        var result = from c in HeaderList group c by c.Key;

        this.ControlPanelGroup.Source = result;

        var collectionGroups = ControlPanelGroup.View.CollectionGroups;
        ((ListViewBase)this.semanticZoom.ZoomedOutView).ItemsSource = collectionGroups;

The Values from the list: 列表中的值:

public class ULSSLinkData
{     
    public string Title { get; set; }
    public string URL { get; set; }
    public string Key { get; set; }
    public bool EXT { get; set; }
}

Here's a GIF SemanticZoom 这是GIF 语义缩放

I have no idea why but changing the zoomedoutview to this magically fixed it. 我不知道为什么,但是将zoomedoutview更改为对此进行了魔术修复。

<SemanticZoom.ZoomedOutView>
                                <ListView x:Name="Headers">
                                    <ListView.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Group.Key}" />
                                        </DataTemplate>
                                    </ListView.ItemTemplate>
                                </ListView>
                            </SemanticZoom.ZoomedOutView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM