Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit cb36e9e

Browse files
committed
Add scroll bar to indicate how much is off screen
Add "Click to view more or reply" message. Scroll to most recent comments.
1 parent 87793e0 commit cb36e9e

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/GitHub.InlineReviews/Views/CommentTooltipView.xaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,19 @@
2525
</x:Array>
2626
</d:DesignProperties.DataContext>
2727

28-
<ItemsControl ItemsSource="{Binding Comments}">
29-
<ItemsControl.ItemTemplate>
30-
<DataTemplate>
31-
<local:CommentView Margin="0 4"/>
32-
</DataTemplate>
33-
</ItemsControl.ItemTemplate>
34-
</ItemsControl>
28+
<DockPanel>
29+
<StackPanel DockPanel.Dock="Bottom">
30+
<Border BorderBrush="Silver" BorderThickness="0,1,0,0" Margin="0,8" />
31+
<TextBlock x:Name="StatusTextBlock" FontStyle="Italic">Click to reply</TextBlock>
32+
</StackPanel>
33+
<ScrollViewer x:Name="CommentScrollViewer" VerticalScrollBarVisibility="Auto">
34+
<ItemsControl ItemsSource="{Binding Comments}">
35+
<ItemsControl.ItemTemplate>
36+
<DataTemplate>
37+
<local:CommentView Margin="0 4"/>
38+
</DataTemplate>
39+
</ItemsControl.ItemTemplate>
40+
</ItemsControl>
41+
</ScrollViewer>
42+
</DockPanel>
3543
</UserControl>

src/GitHub.InlineReviews/Views/CommentTooltipView.xaml.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Windows.Controls;
34

45
namespace GitHub.InlineReviews.Views
@@ -8,6 +9,18 @@ public partial class CommentTooltipView : UserControl
89
public CommentTooltipView()
910
{
1011
InitializeComponent();
12+
13+
CommentScrollViewer.LayoutUpdated += WatchForScrollBarVisible;
14+
}
15+
16+
void WatchForScrollBarVisible(object sender, EventArgs e)
17+
{
18+
if (CommentScrollViewer.ComputedVerticalScrollBarVisibility == System.Windows.Visibility.Visible)
19+
{
20+
CommentScrollViewer.ScrollToBottom();
21+
StatusTextBlock.Text = "Click to view more or reply";
22+
CommentScrollViewer.LayoutUpdated -= WatchForScrollBarVisible;
23+
}
1124
}
1225
}
1326
}

0 commit comments

Comments
 (0)