Snoop 2.8.0 Released – New Features

I have written before about being part of the Snoop team – contributing to the open source code base for the WPF spying utility.  In the past couple months, we gained some good momentum on some cool new features, and now we are proud to announce the availability of the next release:  Snoop 2.8.0. Special shout out to Cory Plotts for all his work in getting this release out.

Download the latest installer here.

Here is a rundown of some of the new features in the new version.

Capture Changes to Properties

My coworkers and I often times end up using Snoop as a kind of “run-time designer”.  Blend can only go so far to show us the run-time look of a given view or control, so we Snoop into our running application and make changes to various properties (font sizes, margins, alignments, etc).  We make these changes interactively, deciding what looks good, and then have to adjust the XAML code accordingly.  If you’ve made changes to more than a couple properties, it’s easy to forget what all the changes were.  This feature will save you.

Whenever you close the Snoop window or the Snooped application, any changes you’ve made to properties during that Snoop session are copied to the clipboard.  You can then paste them into a text editor somewhere to get the concise list of changes.  You don’t have to wait until you stop Snooping to get the list of changes. You can also hit CTRL+SHIFT+C at any time while Snooping to copy the changed property info to the clipboard.  Here’s an example of a set of changes:

Snoop dump as of 2012-10-08 16:34:23
--- OBJECTS WITH EDITED PROPERTIES ---
Object: [008] Rect1 (Rectangle)
Property: Fill, New Value: #FF00208B
Property: Height, New Value: 40
Object: [008] Rect4 (Rectangle)
Property: Canvas.Top, New Value: 45
Object: [007] txtInput (TextBox) 10
Property: Text, New Value: hello world

The output is organized in a hierarchy, listing each object that contains at least one property that was changed, and then grouping all the changed properties on that object together.  The identifier for the object matches how it’s displayed in the Snoop visual tree UI.

 

Show Binding Paths

WPF is all about Bindings.  You have a ton of them in any “real” WPF app.  Often, even when the binding is working, I want to see the Path the binding is using, maybe as a way to quickly find the VM property backing a particular UI element.  I decided that a bound property in Snoop should show you the Binding.Path right away, without making you delve into the Binding to see that important info.  Here are some screenshots of various bindings in my sample app:

Basic Binding – shows full property path in brackets next to the value

CropperCapture246

ElementName Binding – shows both the Path and ElementName

CropperCapture255

MultiBinding – shows each Path and optional ElementName

CropperCapture240

PriorityBinding – shows each Path in priority order

CropperCapture256

 

Show Resource Keys

Since we’ve moved the Snoop source code to GitHub, we’ve been receiving some pull requests with various feature implementations.  One of them, from Dawn Wright, is simple, yet powerful.  Now when Snoop displays a Brush or Style that is a keyed resource, it will show you the x:Key property of the resource.  This is super valuable when Snooping through an app that you didn’t write, allowing you to find the resources a given object uses.  Here’s are a couple examples:

Inline Brush – not referencing a keyed resource (notice any Type is now in [brackets] )

CropperCapture257

Brush that References a Keyed Resource

CropperCapture259

Style that References a Keyed Resource

CropperCapture258

 

PowerShell Integration

I’m not a huge PowerShell user, but I can already tell this contribution from Bailey Ling is a killer new feature.  There is a new PowerShell tab in the Snoop window that lets you party on your objects, using PowerShell commands.  The most basic commands that I know are to set a variable that points to the DataContext of one of your elements, then start making calls to properties and methods in that object graph.

$vm = $selected.Target.DataContext
$vm.Name = “foo”

The possibilities are endless…

Check out Bailey’s introduction to the concept in his two blog posts. One and Two.

CropperCapture267

Other Minor Enhancements

ESC key now clears any current search filter.

If Snoop throws an exception from within itself, we catch it and don’t blow up your app.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>