mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 12:09:40 +00:00
Select the text in the textbox once it gets focus, for a more user-friendly browsing experience.
This commit is contained in:
@@ -29,8 +29,9 @@
|
||||
DockPanel.Dock="Right"
|
||||
Command="{Binding GoCommand}">Go</Button>
|
||||
<TextBox Height="23"
|
||||
Name="urlTextBox"
|
||||
Text="{Binding AddressEditable, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
Text="{Binding AddressEditable, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
GotKeyboardFocus="OnTextBoxGotKeyboardFocus"
|
||||
GotMouseCapture="OnTextBoxGotMouseCapture">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter"
|
||||
Command="{Binding GoCommand}" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CefSharp.Wpf.Example.Views.Main
|
||||
{
|
||||
@@ -8,5 +9,17 @@ namespace CefSharp.Wpf.Example.Views.Main
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnTextBoxGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
var textBox = (TextBox) sender;
|
||||
textBox.SelectAll();
|
||||
}
|
||||
|
||||
private void OnTextBoxGotMouseCapture(object sender, MouseEventArgs e)
|
||||
{
|
||||
var textBox = (TextBox) sender;
|
||||
textBox.SelectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user