我想仅使用转换来反转ListBox中的项目。我有这个尝试(下面)。但是,我希望右边的项目从顶部流下来。有人能看到怎么做吗?
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.Resources>
<Style TargetType="ListBoxItem" x:Key="R">
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="1" ScaleY="-1"/>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListBox>
<ListBoxItem>A</ListBoxItem>
<ListBoxItem>B</ListBoxItem>
<ListBoxItem>C</ListBoxItem>
<ListBoxItem>D</ListBoxItem>
<ListBoxItem>E</ListBoxItem>
<ListBoxItem>F</ListBoxItem>
</ListBox>
<ListBox Grid.Column="1" RenderTransformOrigin="0.5,0.5">
<ListBox.RenderTransform>
<ScaleTransform ScaleX="1" ScaleY="-1"/>
</ListBox.RenderTransform>
<ListBoxItem Style="{StaticResource R}">V</ListBoxItem>
<ListBoxItem Style="{StaticResource R}">U</ListBoxItem>
<ListBoxItem Style="{StaticResource R}">W</ListBoxItem>
<ListBoxItem Style="{StaticResource R}">X</ListBoxItem>
<ListBoxItem Style="{StaticResource R}">Y</ListBoxItem>
<ListBoxItem Style="{StaticResource R}">Z</ListBoxItem>
</ListBox>
</Grid>
</Window>
答案 0 :(得分:1)
我找到了我要找的东西。 VerticalAlignment
是踢球者:
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel VerticalAlignment="Top" Orientation="Vertical">
<VirtualizingStackPanel.LayoutTransform>
<ScaleTransform ScaleX="1" ScaleY="-1" />
</VirtualizingStackPanel.LayoutTransform>
</VirtualizingStackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>