应用ListBox.GroupStyle时,ItemsPanelTemplate中的WrapPanel不起作用。 [英] WrapPanel in ItemsPanelTemplate doesn't work when ListBox.GroupStyle is applied.

查看:139
本文介绍了应用ListBox.GroupStyle时,ItemsPanelTemplate中的WrapPanel不起作用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<ListBox ItemsSource="{Binding Reports}" Margin="10,92,10,10" ScrollViewer.HorizontalScrollBarVisibility="Disabled"  ScrollViewer.VerticalScrollBarVisibility="Disabled">
           <ListBox.GroupStyle>
               <GroupStyle>
                   <GroupStyle.HeaderTemplate>
                       <DataTemplate>
                           <TextBlock Text="{Binding Path=Name}" />
                       </DataTemplate>
                   </GroupStyle.HeaderTemplate>
               </GroupStyle>
           </ListBox.GroupStyle>
           <ListBox.ItemsPanel>
               <ItemsPanelTemplate>
                   <WrapPanel Orientation="Vertical" IsItemsHost="True">
                   </WrapPanel>
               </ItemsPanelTemplate>
           </ListBox.ItemsPanel>
       </ListBox>





如果我删除Grou,WrapPanel工作正常pStyle但使用GroupStyle Wrapping不起作用,它显示为普通List。



Hi, WrapPanel works fine if I remove GroupStyle but with GroupStyle Wrapping doesn't work and it's shown as normal List.

推荐答案

尝试设置 GroupStyle.Panel ,或升级到.NET 4.5:

使用WrapPanel设置ListView.GroupStyle样式 - StackOverflow [ ^ ]
Try setting the GroupStyle.Panel, or upgrading to .NET 4.5:
Styling ListView.GroupStyle with a WrapPanel - StackOverflow[^]


这篇关于应用ListBox.GroupStyle时,ItemsPanelTemplate中的WrapPanel不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆