我觉得标题不清楚
我正在使用 WPF 并创建自定义消息控件
。我有 message User Control
和显示在 custom Messages control
[ListBox
] 中的消息用户控件。
XAML 代码:
<ListBox x:Name="uiMessages" ItemsSource="{Binding Path=Messages}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<wpfMessages:MessageDisplay>
</wpfMessages:MessageDisplay>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
当前 View :
预期:
现在列表框项目从上到下显示,红色消息后有空白区域。如果 2 条绿色消息在底部,红色消息在顶部,我会很好。预期是从 botton 到 top 添加消息,而不是像现在这样从 top 到 botton。
有什么想法吗?
在此先感谢 Jamaxack!
最佳答案
有点不清楚,但我认为您想更改 ItemsPanel 布局。
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel VerticalAlignment="Bottom"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
关于c# - WPF:ListBox 项目从下到上显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27956390/