XAML grouped GridView/Semantic Zoom not displaying all children?

♀尐吖头ヾ 提交于 2019-12-04 12:37:59

I think I know where's the problem - this happens if you are adding items to the GridView programatically group after group. What happens here is when you add the first group with n items to the GridView source, then number n is kept and for each group added afterwards it shows no more than n items, even though there is more items.

So if you have 5 groups in collection with 2,4,1,5,3 items, you assign empty ObservableCollection as the ItemSource of the GridView and then you add in foreach these groups into the ObservableCollection, you will see only 2,2,1,2,2 items in each group.

I don't know why this is happening, if it's feature or a bug, but you can solve it either by loading the ObservableCollection first and then assigning it to the GridView as a source, or you can use some kind of converter, that will return for each group same number of items. For groups with lesser number you then add fake empty items and hide them using different DataTemplate.

Edit: I've just noticed you are already adding the collection at once, so the problem is probably elsewhere. Maybe the root you your issue is this in ItemsPanel?

MaximumRowsOrColumns="1"

I have the same problem . And this at resolved the pb .

In the SemanticZoom.ZoomedInView replace

<ItemsPanelTemplate>
<WrapGrid Orientation="Vertical" MaximumRowsOrColumns="1" />
</ItemsPanelTemplate>

by

<ItemsPanelTemplate>
         <VirtualizingStackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
you need to use stackpanel instead of  WrapGrip in ItemPanelTemplate

<GridView.ItemsPanel>
           <ItemsPanelTemplate>
               <StackPanel Orientation="Horizontal" />
           </ItemsPanelTemplate>
</GridView.ItemsPanel>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!