Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 Search Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
NavigationCommands..::.Search Property

Gets the value that represents the Search command.

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/xaml/presentation
Visual Basic (Declaration)
Public Shared ReadOnly Property Search As RoutedUICommand
Visual Basic (Usage)
Dim value As RoutedUICommand

value = NavigationCommands.Search
C#
public static RoutedUICommand Search { get; }
Visual C++
public:
static property RoutedUICommand^ Search {
    RoutedUICommand^ get ();
}
JScript
public static function get Search () : RoutedUICommand
XAML Attribute Usage
<object property="NavigationCommands.Search"/>

Property Value

Type: System.Windows.Input..::.RoutedUICommand
The routed UI command.

Default Values

Key Gesture

F3

UI Text

Search

This command indicates the intention to search.

There is no implementation for responding to the Search command on any given WPF class. As such, you need to provide an appropriate implementation, which is shown in the example.

The following example shows how to implement code that responds to the Search command in conjunction with a FlowDocumentPageViewer.

<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="SDKSample.Search">

  <Window.CommandBindings>
    <CommandBinding
      Command="NavigationCommands.Search"
      CanExecute="navigationCommandSearch_CanExecute"
      Executed="navigationCommandSearch_Executed" />
  </Window.CommandBindings>


...


<!-- NavigationCommands.Search -->
<MenuItem Command="NavigationCommands.Search" />


...


<FlowDocumentPageViewer Name="flowDocumentPageViewer">
  <FlowDocument>
    <!-- Document Content-->
    <Paragraph>
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vulputate, lacus non sagittis pharetra, diam dolor dictum tellus, et hendrerit odio risus nec erat. Nam sollicitudin imperdiet mi. Sed rutrum. Morbi vel nunc. Donec imperdiet. Morbi hendrerit leo. Maecenas imperdiet. Curabitur viverra tempor nisi. Phasellus vitae augue sit amet neque venenatis elementum. Proin posuere lobortis quam. Curabitur et neque. Donec ac sem vitae libero pharetra luctus. Fusce purus. Nulla vehicula, leo commodo dictum lobortis, odio augue accumsan ante, id dictum nisi libero quis diam. Nam augue erat, malesuada eu, tincidunt eu, dictum ut, ante. In vel magna vel ligula faucibus lobortis. Praesent a felis non mi fringilla vulputate. Integer quis tellus cursus elit tincidunt vehicula. Morbi commodo sem eu eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
    </Paragraph>


...


  </FlowDocument>
</FlowDocumentPageViewer>


...


</Window>

C#
using System.Windows; // Window
using System.Windows.Input; // CanExecuteRoutedEventArgs, ExecutedRoutedEventArgs

namespace SDKSample
{
    public partial class Search : Window
    {
        public Search()
        {
            InitializeComponent();
        }

        void navigationCommandSearch_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            // Can search of there is a document
            e.CanExecute = (this.flowDocumentPageViewer.Document != null);
        }

        void navigationCommandSearch_Executed(object target, ExecutedRoutedEventArgs e)
        {
            // Implement custom Search handling code
        }
    }
}

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker