Wpf 水平对齐列表视图项
我需要水平放置我的listviewitems,但我找不到方法,到目前为止我尝试了以下方法:Wpf 水平对齐列表视图项,wpf,alignment,listviewitem,Wpf,Alignment,Listviewitem,我需要水平放置我的listviewitems,但我找不到方法,到目前为止我尝试了以下方法: <ListView Grid.Row="0" ItemsSource="{Binding Path=Cells, UpdateSourceTrigger=PropertyChanged}" ItemTemplate="{StaticResource CellGroupTemplate}" Backgr
<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>
“我的项目”是附加了viewmodel的其他UI控件
<DataTemplate DataType="{x:Type vm:CellItemViewModel}" x:Key="CellGroupTemplate">
<vw:CellItemView/>
</DataTemplate>
有人能告诉我如何将每个元素(datatemplate)放在另一个元素旁边吗
谢谢您可以为ListView设置自定义项目面板:
您可以为ListView设置自定义项目面板:
<ListView>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>