XAML key bindings

This commit is contained in:
Paul Rouget 2019-11-04 12:19:12 +01:00
parent 7fb12fcc43
commit 749f2217f9
3 changed files with 33 additions and 1 deletions

View file

@ -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) {