diff --git a/support/hololens/ServoApp/BrowserPage.cpp b/support/hololens/ServoApp/BrowserPage.cpp index a9de7e2942d..98521ccd7da 100644 --- a/support/hololens/ServoApp/BrowserPage.cpp +++ b/support/hololens/ServoApp/BrowserPage.cpp @@ -7,6 +7,7 @@ #include "BrowserPage.h" #include "BrowserPage.g.cpp" +using namespace std::placeholders; using namespace winrt::Windows::Foundation; using namespace winrt::Windows::UI::Xaml; using namespace winrt::Windows::UI::Core; @@ -50,6 +51,17 @@ void BrowserPage::BindServoEvents() { }); servoControl().OnCaptureGesturesEnded( [=] { navigationBar().IsHitTestVisible(true); }); + urlTextbox().GotFocus(std::bind(&BrowserPage::OnURLFocused, this, _1)); +} + +void BrowserPage::OnURLFocused(Windows::Foundation::IInspectable const &) { + urlTextbox().SelectAll(); +} + +void BrowserPage::OnURLKeyboardAccelerator( + Windows::Foundation::IInspectable const &, + Windows::UI::Xaml::Input::KeyboardAcceleratorInvokedEventArgs const &) { + urlTextbox().Focus(FocusState::Programmatic); } void BrowserPage::LoadServoURI(Uri uri) { diff --git a/support/hololens/ServoApp/BrowserPage.h b/support/hololens/ServoApp/BrowserPage.h index 8c3a540d4c1..6c1af3f9059 100644 --- a/support/hololens/ServoApp/BrowserPage.h +++ b/support/hololens/ServoApp/BrowserPage.h @@ -26,6 +26,10 @@ public: Windows::UI::Xaml::RoutedEventArgs const &); void OnURLEdited(Windows::Foundation::IInspectable const &, Windows::UI::Xaml::Input::KeyRoutedEventArgs const &); + void OnURLFocused(Windows::Foundation::IInspectable const &); + void OnURLKeyboardAccelerator( + Windows::Foundation::IInspectable const &, + Windows::UI::Xaml::Input::KeyboardAcceleratorInvokedEventArgs const &); void Shutdown(); void LoadServoURI(Windows::Foundation::Uri uri); void SetTransientMode(bool); diff --git a/support/hololens/ServoApp/BrowserPage.xaml b/support/hololens/ServoApp/BrowserPage.xaml index 87aa72321a6..3cd8aabff55 100644 --- a/support/hololens/ServoApp/BrowserPage.xaml +++ b/support/hololens/ServoApp/BrowserPage.xaml @@ -94,18 +94,34 @@ - + + + + +