示例#1
0
        private void SearchBox_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (!(DataContext is WebPageViewModel vm))
            {
                return;
            }

            if (e.Key == Windows.System.VirtualKey.Enter)
            {
                var be = SearchTextBox.GetBindingExpression(TextBox.TextProperty);
                be.UpdateSource();
                vm.SearchCommand?.Execute(null);
            }
        }
示例#2
0
        private void SearchTextBox_OnTextChanged(object sender, TextChangedEventArgs e)
        {
            BindingExpression be = SearchTextBox.GetBindingExpression(TextBox.TextProperty);

            be.UpdateSource();
        }