Ok, so I have a general question about WPF. I've messed a little with ASP.NET MVC and in the markup it has intellisense on your viewmodel object so you don't mistype it( i love it).
Enter WPF, I love it, I'm utilizing the MVVM approach and one annoying thing that I have to do is make sure I'm binding correctly to my viewmodel. So I type something up in my xaml, then I either 1) if I'm lazy just run the app and click around 2) If i'm not lazy a)Look at the current DataContext of the control I'm working with. b)Go to that ViewModel class look at the properties c)Find my property and then click back to my view and make sure that I spelled it correctly.
I believe that you can look at your trace output for incorrect bindings at run time, but is there something in the horizon to allow intellisense in xaml. The View needs to know about my ViewModel, so why not expose that in xaml.
I think it would be nice for the IDE to do that for me, meaning, when I type "{Binding " it should go up the visual tree find the first non-null DataContext and display the properties, let me select one and there you have it.
Am I missing something? Are there any alternatives. Any insight?
EDIT:
Regarding the comments below there is a way to set the datacontext at design time e.g.
<Window.Resources>
<DesignTimeData:DesignTimeCustomers x:Key="designTimeCustomersDS" />
</Window.Resources>
which is a snippet from this blog: http://karlshifflett.wordpress.com/2008/10/11/viewing-design-time-data-in-visual-studio-2008-cider-designer-in-wpf-and-silverlight-projects/
All it does is reference a class within xaml.
So with that in place could not the designer then utilize reflection on the datacontext to give you all of the properties for that class?
VS 2013:
IntelliSense with resolved DataContext
IntelliSense with design time DataContext
So with that in place could not the designer then utilize reflection on the datacontext to give you all of the properties for that class?
Resharper 6 has this feature and can show you members of the d:DataContext in the intellisense, if you set the d:DataContext on the View.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With