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/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Visual Basic (Declaration)
Public Shared ReadOnly Property Search As RoutedUICommand
Dim value As RoutedUICommand
value = NavigationCommands.Search
public static RoutedUICommand Search { get; }
public:
static property RoutedUICommand^ Search {
RoutedUICommand^ get ();
}
public static function get Search () : RoutedUICommand
<object property="NavigationCommands.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>
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
Reference
Other Resources