update doc

This commit is contained in:
NaBian committed 2020-07-24 00:10:06 +08:00
1 parent f45aa5471c
commit 50776441ef
9 files changed
+136 -24

No files matched your search

@@ -17,7 +17,7 @@
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListBox Name="ListBoxChat" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.CanContentScroll="False" Background="Transparent" hc:ChatBubble.MaxWidth="300" BorderThickness="0" Style="{StaticResource StackPanelVerticalListBox}" ItemsSource="{Binding ChatInfos}">
<ListBox Name="ListBoxChat" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.CanContentScroll="False" Background="Transparent" BorderThickness="0" Style="{StaticResource StackPanelVerticalListBox}" ItemsSource="{Binding ChatInfos}">
<hc:Interaction.Triggers>
<hc:RoutedEventTrigger RoutedEvent="hc:ChatBubble.Selected">
<hc:EventToCommand Command="{Binding ReadMessageCmd}" PassEventArgsToCommand="True" />
@@ -25,7 +25,7 @@
</hc:Interaction.Triggers>
<ListBox.ItemTemplate>
<DataTemplate>
<hc:ChatBubble Role="{Binding Role}" Type="{Binding Type}" Content="{Binding Message}" Tag="{Binding}"/>
<hc:ChatBubble MaxWidth="300" Role="{Binding Role}" Type="{Binding Type}" Content="{Binding Message}" Tag="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
@@ -10,17 +10,12 @@ namespace HandyControlDemo.UserControl
public ChatBox()
{
InitializeComponent();
ListBoxChat.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged;
}
private void ItemContainerGenerator_ItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs e)
{
if (_scrollViewer == null)
{
_scrollViewer = VisualHelper.GetChild<ScrollViewer>(ListBoxChat);
}
_scrollViewer ??= VisualHelper.GetChild<ScrollViewer>(ListBoxChat);
_scrollViewer?.ScrollToBottom();
}
}