VS2015 Preview: XAML Peek

In Visual Studio 2015 Preview, you can now peek and edit definitions from XAML. Let’s take a look at some examples from Lilly Notes, a WPF application I built upon WPF MDI.

You can Peek Definition in your XAML editor via a context menu when right-clicking, or by pressing Alt+F12:

vs2015-xaml-peek-context-menu

If you do that on an event handler, you can peek into the event handler’s definition in the codebehind, without ever leaving your XAML:

vs2015-xaml-peek-edit

For more extended editing, you can “Promote to Document” (see screenshot above) to open the actual code file.

If you have an ElementName binding, you can peek into the definition of the target element, as you can see below with ToggleEditTitleButton:

vs2015-xaml-peek-elementname

XAML Peek also works pretty nicely with resources, which may be scattered about your project. For instance, I’m using this BoolToHiddenConverter as a StaticResource. I can peek its definition in the UserControl’s Resources section:

vs2015-xaml-peek-resource2

As it turns out, I can also peek the resource’s type (in this case BoolToVisibilityConverter), to edit the converter directly:

vs2015-xaml-peek-resource

No doubt this feature will be pretty handy for those writing some of the larger WPF or Windows Phone 8 applications.

Leave a Reply

Your email address will not be published. Required fields are marked *