Skip to content

Commit 7a35bae

Browse files
Merge pull request #131 from CodebreakerApp/130-winui-scrollviewer
130 winui scrollviewer
2 parents c7c9eba + 8cd831c commit 7a35bae

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/Codebreaker.WinUI/Codebreaker.WinUI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
5656
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
5757
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
58-
<PackageReference Include="Microsoft.Identity.Client" Version="4.58.1" />
58+
<PackageReference Include="Microsoft.Identity.Client" Version="4.59.0" />
5959
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.231202003-experimental1" />
6060
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.25936-preview" />
6161
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />

src/Codebreaker.WinUI/Views/Pages/GamePage.xaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,15 @@
9494
ViewModel="{x:Bind ViewModel, Mode=OneWay}" />
9595
</StackPanel>
9696
<!--Move section-->
97-
<ListBox
98-
x:Name="listGameMoves"
99-
Grid.Row="2"
100-
Background="Transparent"
101-
SelectedIndex="-1"
102-
IsHitTestVisible="False"
103-
Visibility="{x:Bind ViewModel.GameStatus, Mode=OneWay, Converter={StaticResource GameStatusVisibility}, ConverterParameter=Running}"
104-
ItemsSource="{x:Bind ViewModel.GameMoves, Mode=OneWay}"
105-
ItemTemplate="{StaticResource PegsTemplate}" />
97+
<ScrollViewer Grid.Row="2" Padding="0,0,0,15" x:Name="pegScrollViewer">
98+
<ListBox
99+
x:Name="listGameMoves"
100+
Background="Transparent"
101+
SelectedIndex="-1"
102+
IsHitTestVisible="False"
103+
Visibility="{x:Bind ViewModel.GameStatus, Mode=OneWay, Converter={StaticResource GameStatusVisibility}, ConverterParameter=Running}"
104+
ItemsSource="{x:Bind ViewModel.GameMoves, Mode=OneWay}"
105+
ItemTemplate="{StaticResource PegsTemplate}" />
106+
</ScrollViewer>
106107
</Grid>
107108
</Page>

src/Codebreaker.WinUI/Views/Pages/GamePage.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@ public void Receive(GameMoveMessage message)
4141
animation.Configuration = new BasicConnectedAnimationConfiguration();
4242
animation.TryStart(ellipse);
4343
});
44+
45+
// Scroll to bottom
46+
pegScrollViewer.UpdateLayout();
47+
pegScrollViewer.ScrollToVerticalOffset(pegScrollViewer.ScrollableHeight);
4448
}
4549
}

0 commit comments

Comments
 (0)