Skip to content

Commit d5c5af3

Browse files
committed
Set up TextBox to execute ScrollToHome() after SelectAll()
1 parent f1c0b6f commit d5c5af3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

IPConfig/Behaviors/TripleClickToSelectAllBehavior.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChan
4141

4242
private static void OnTextBoxMouseDown(object sender, MouseButtonEventArgs e)
4343
{
44-
if (e.ClickCount == 3)
44+
if (sender is TextBox textBox && e.ClickCount == 3)
4545
{
46-
((TextBox)sender).SelectAll();
46+
textBox.SelectAll();
47+
textBox.ScrollToHome();
4748
}
4849
}
4950
}

IPConfig/Views/IPConfigDetailView.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public IPConfigDetailView()
3232
if (m.Gesture == "F2")
3333
{
3434
tbIPConfigName.Focus();
35+
tbIPConfigName.SelectAll();
36+
tbIPConfigName.ScrollToHome();
3537
}
3638
});
3739
}

0 commit comments

Comments
 (0)