Resharper is an amazing tool for any .Net developers. The latest version 6.1 has been released just a couple of weeks ago and I wanted to share with you a brief overview of the new workflow available in the XAML world !
Visual Studio 2010 introduced 2 new design time properties: d:DesignInstance and d:DesignData. Those properties can be used in order to specify a design time DataContext in order to have more help during the creation of a binding.
For example, when you create a binding using the Property dialog of VS2010 you can browse your DataContext to select the right property (image from this blog post from Karl Shifflet):
Resharper 6.1 is now able to use those metadata in order to improve the experience you have while typing XAML (which I personally do a LOT!). Here is how it works:
- you create a new ViewModel with a simple property (this property has just get/set because we don’t need much more in the context of this post…)
- you setup a binding in your view
At this point the ReSharper magic comes into play…
- ReSharper warns you the DataContext is unknown
- Offer the ability to fix this
- Note that like in C#, you can very easily resolve namespace issues
- Then notice that the warning is gone (the Title property is no longer underlined)
- You can now add a new binding
- You can then ask ReSharper to create the property in your ViewModel
- Choosing the first option will get you to the ViewModel definition
Now that I’ve upgraded my installation to version 6.1, I think this is a must have !
That’s all for today ! Hope it helps 🙂