我需要水平放置我的listviewitems,但我找不到方法,到目前为止,我尝试了以下方法:
<ListView Grid.Row="0" ItemsSource="{Binding Path=Cells, UpdateSourceTrigger=PropertyChanged}"
ItemTemplate="{StaticResource CellGroupTemplate}"
Background="{StaticResource EnvLayout}"
HorizontalContentAlignment="Stretch">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
</Style.Resources>
</Style>
</ListView.ItemContainerStyle>
</ListView>我的项目是附加了视图模型的其他UI控件
<DataTemplate DataType="{x:Type vm:CellItemViewModel}" x:Key="CellGroupTemplate">
<vw:CellItemView/>
</DataTemplate>有人能告诉我如何把每个元素(数据模板)放在一起吗
谢谢
发布于 2013-02-18 19:54:14
您可以为ListView设置自定义项目面板
<ListView>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>https://stackoverflow.com/questions/14935575
复制相似问题