问题描述
||
好的,这是我的简单问题。
我设置了一个“ 0”样式,以使其看起来像Windows资源管理器。
现在,我想将项目分组。因此,我定义了
GroupStyle
和an2ѭ进行分组。分组现在很好。
我现在不喜欢的是,我的ListView
将每个组显示在单独的行上,而我想进行一些扩展器包装,以便在同一行上显示许多组。
我猜图像比文字更好。
这是我所拥有的:
这是我想要的:
我找不到为使ѭ4适应WrapPanel而必须设置样式的属性,就像我为商品所做的那样。
这是我的ListView样式:
<ResourceDictionary>
<!-- Explorer-style layout-->
<DataTemplate x:Key=\"ExplorerView\">
<StackPanel Orientation=\"Horizontal\" Height=\"Auto\" Width=\"150\">
<Image Source=\"{Binding Path=Value.AppConfig.Appli.AppType,Converter={StaticResource TypeToIconConverter}}\" Margin=\"5\"
Height=\"50\" Width=\"50\"/>
<StackPanel VerticalAlignment=\"Center\" Width=\"90\">
<TextBlock Text=\"{Binding Path=Value.AppConfig.Appli.AppName}\"
FontSize=\"13\" HorizontalAlignment=\"Left\" TextWrapping=\"WrapWithOverflow\"
Margin=\"0,1\" />
<TextBlock Text=\"{Binding Path=Value.AppConfig.Appli.AppType}\" FontSize=\"9\"
HorizontalAlignment=\"Left\" Margin=\"0,1\" />
</StackPanel>
</StackPanel>
</DataTemplate>
<!-- Group header style-->
<Style x:Key=\"GroupHeaderStyle\" TargetType=\"{x:Type GroupItem}\">
<Setter Property=\"Template\">
<Setter.Value>
<ControlTemplate TargetType=\"{x:Type GroupItem}\">
<Expander x:Name=\"exp\" IsExpanded=\"True\" Width=\"310\"
BorderBrush=\"CornflowerBlue\">
<Expander.Header>
<DockPanel HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Stretch\"
Background=\"CornflowerBlue\" x:Name=\"expContent\"
Width=\"{Binding RelativeSource={RelativeSource
Mode=FindAncestor,AncestorType={x:Type Expander}},Path=Width}\"
Height=\"{Binding RelativeSource={RelativeSource
Mode=FindAncestor,AncestorType={x:Type ToggleButton}},Path=ActualHeight}\">
<CheckBox IsChecked=\"False\" DockPanel.Dock=\"Right\"/>
<TextBlock Text=\"{Binding Path=Name}\" Foreground=\"White\"
FontWeight=\"Bold\" HorizontalAlignment=\"Center\" />
</DockPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
<!-- (...) -->
<ListView ItemsSource=\"{Binding GroupedConfig,Mode=TwoWay}\"
ItemTemplate=\"{StaticResource ExplorerView}\">
<ListView.ItemsPanel>
<ItemsPanelTemplate >
<WrapPanel Width=\"{Binding (FrameworkElement.ActualWidth),RelativeSource={RelativeSource
AncestorType=Expander}}\"
ItemWidth=\"{Binding (ListView.View).ItemWidth,RelativeSource={RelativeSource AncestorType=ListView}}\"
ItemHeight=\"{Binding (ListView.View).ItemHeight,RelativeSource={RelativeSource AncestorType=ListView}}\" />
<!--MinWidth=\"{Binding ItemWidth,RelativeSource={RelativeSource Self}}\"-->
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.GroupStyle>
<GroupStyle ContainerStyle=\"{StaticResource GroupHeaderStyle}\" />
</ListView.GroupStyle>
</ListView>
有任何想法吗?
我试图以为GroupItem
定义的样式插入一些适当的Setter
,但是我开始认为这不是正确的方法。
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)