How to: Go to the Definition of an Object in XAML
There are a variety of ways to go to the definition of an object in XAML by using the WPF Designer for Visual Studio. This topic describes several ways.
To go to the definition of a control in the WPF Designer
Select the control in Design view.
The control definition is highlighted in XAML view.
To go to the definition of a control from the code-behind file
In the Code Editor, right-click the control's symbol and select Go To Definition from the context menu.
The control definition is highlighted in XAML view.
To go to the definition of a control from the Object Browser
From the View menu, select Object Browser.
The Object Browser window opens.
Locate your project in the Object Browser.
Expand the nodes until you find the class where the control is defined.
Select the class.
The control appears in the right pane of the Object Browser.
In the right pane, double-click the control.
The control definition is highlighted in XAML view.
To view the definition of a control in the Code Definition window
From the View menu, select Code Definition Window.
In the Code Editor, click the control's symbol.
The control definition appears in the Code Definition Window.
Note
This feature is not available in Visual Basic.
To go to the definition of a control from the tag navigator
In XAML view, use the tag navigator at the bottom of the view to find the control.
The control definition is highlighted in XAML view.
To view all the references to a control
In the Code Editor, right-click the control's symbol and select Find All References from the context menu.
All references to the control are listed in the Find Symbol Results window.
To go to the definition of a control from the Class View window
From the View menu, select Class View.
The Class View window opens.
Locate your project in the Class View window.
Expand the nodes until you find the class where your control is defined.
Select the class.
The control will appear in the bottom pane of the Class View window.
In the bottom pane, double-click the control.
The control definition is highlighted in XAML view.
To go to the definition of an object by using the Document Outline window
From the View menu, point to Other Windows and then select Document Outline.
The Document Outline window opens.
Browse the document outline until the object is found.
Click the object in the Document Outline window.
The object definition is highlighted in XAML view.
To go to the definition of an object by the object's name
From the Edit menu, point to Find and Replace, and then select Quick Find.
The Find and Replace window opens.
Type the name of the object you want to find in the Find what: box and then click Find Next.
If necessary, continue to click Find Next until the object is found.
The object definition is highlighted in XAML view.
To go to the definition of a resource from the Properties window
Select a control and view its properties in the Properties window.
Click the property marker for a property and choose Go to Value Definition to navigate to the definition of the resource. The following illustration shows an example.
See Also
Concepts
Split View: Viewing the WPF Design Surface and XAML at the Same Time
Navigating the Element Hierarchy of a WPF Document
Other Resources
XAML and Code in the WPF Designer
Change History
Date |
History |
Reason |
---|---|---|
March 2011 |
Added information about Go to Value Definition. |
Information enhancement. |