From 18db01cec4a1f69979e5c4cdb1aad292ee5aed3e Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 9 Feb 2022 11:26:13 +0100 Subject: [PATCH] Added a repro for #77. --- samples/ProControlsDemo/MainWindow.axaml.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/samples/ProControlsDemo/MainWindow.axaml.cs b/samples/ProControlsDemo/MainWindow.axaml.cs index ee5c7c08..a8393056 100644 --- a/samples/ProControlsDemo/MainWindow.axaml.cs +++ b/samples/ProControlsDemo/MainWindow.axaml.cs @@ -37,6 +37,7 @@ public MainWindow() public void AddCountryClick(object sender, RoutedEventArgs e) { + var countries = this.FindControl("countries"); var countryTextBox = this.FindControl("countryTextBox"); var regionTextBox = this.FindControl("regionTextBox"); var populationTextBox = this.FindControl("populationTextBox"); @@ -57,7 +58,12 @@ public void AddCountryClick(object sender, RoutedEventArgs e) null, null, null); - ((MainWindowViewModel)DataContext!).Countries.AddCountry(country); + var vm = (MainWindowViewModel)DataContext!; + vm.Countries.AddCountry(country); + + var index = vm.Countries.Source.Rows.Count - 1; + countries.RowsPresenter!.BringIntoView(index); + countries.TryGetRow(index)?.Focus(); } private void InitializeComponent()