0
內UWP ItemsStackPanel拉伸的HorizontalAlignment我有一個ListView至極始終保持它的最後一項聚焦:一個ListView
<ListView x:Name="invertedListView_lstv" Grid.Row="0" IncrementalLoadingTrigger="Edge" VerticalAlignment="Stretch" Padding="0, 10, 0, 0" SelectionChanged="invertedListView_lstv_SelectionChanged" Margin="0, 0, 0, 10" HorizontalContentAlignment="Stretch">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel VerticalAlignment="Bottom" ItemsUpdatingScrollMode="KeepLastItemInView" Grid.ColumnSpan="1"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
如果我元素加入到這個名單都顯示在左側。如果我將深綠色的HorizontalAlignment設置爲Right,它們也會出現在左側。
if (Chat.userAccountId.Equals(msg.fromUser))
{
invertedListView_lstv.Items.Insert(0, new SpeechBubbleDownControl() { Text = msg.message, Date = msg.date.ToLocalTime(), HorizontalAlignment = HorizontalAlignment.Right});
}
else
{
invertedListView_lstv.Items.Insert(0, new SpeechBubbleTopControl() { Text = msg.message, Date = msg.date.ToLocalTime() });
}
有沒有辦法來解決這個問題,在不犧牲ItemsStackPanel的KeepLastItemInView?