Updated In the Box MVVM Training

I’ve posted an update to In the Box, MVVM Training:

http://visualstudiogallery.msdn.microsoft.com/en-us/3ab5f02f-0c54-453c-b437-8e8d57eb9942

The update corrects WPF data binding issues when the current culture is not en-US.

  • Corrected two spelling errors
  • Corrected the SearchView user controls, changing the data format string to {0:d}
  • Added code to each App.xaml.cs Startup method to set WPF data binding culture to the current culture.  This corrects the DatePicker data binding problems.

Many thanks to those that posted comments and suggestions.

Have a great day,

Just a grain of sand on the worlds beaches.

11 Responses to Updated In the Box MVVM Training

  1. [...] This post was mentioned on Twitter by Stefano Paluello, patterns & practices. patterns & practices said: Karl Shifflett: Updated In the Box MVVM Training – http://cut.ms/5U5 [...]

  2. This is from the Patterns and Practices people?
    I stopped at “During Self-Discovery Questions I started to ask those questions?”, but had other questions.

    Why are buttons prefixed with btn (and other ux/ui widgets)? I thought Hungarian notation was not good. I know the vote is still out on this, has the community opted for using ux as a prefix for widgets? uxCancel, uxSave?
    Also why the use of underscore for fields? I thought using “this.” was enough. The code looks goofy with “this._” it is redundant. this.repository would be sufficient. As I was looking for local object vs. a field I noticed you also use short hand “btn”. Short hand can become ambiguous. Bing search, did you mean the Big Ten Network, Behind the News, ohh I read more of the code and infered that btn was button, got it.

    I know the time constraints, but why put out something related to patterns & practice but not practice all the patterns. Was StyleCop or FxCop used on this project? Are we to glance over these anti-patterns to focus on the one MVVM pattern you are trying to hightlight?

    I guess I’m wrong to assume that patterns & practice people are link Monk. Cross your T’s, dot your I’s, and make sure to clean up after yourself.

    • To be clear, I did this on my own time not related or connected to patterns & practices.

      I use a coding style that works for me.

      To really understand why the first demo is written the way it was you need to read the scenario and put yourself in the shoes of the developer writing the code. This person was a new developer, was naming controls, etc. This is the type of code that person could write.

      Cheers,

      Karl

      • Yes, but the question I put forth is it the responsibility of the more advance programmers publishing code for the new developers to be done in a way that will not be a stumbling block from them later on in life?

        I apologize on the patterns & practices. I figured this was a Pattern which would fall under patterns and practices. I guess I better find the more advance example that uses the sytels that Microsoft puts forth.

        • You are talking about a gray area at best and one that changes. Most companies have their own coding standards that meet their needs.

          Trying to please everyone is lose-lose. Like I said, “I use a coding style that works for me.”

          Point me to your blog post on coding standards, would be nice to read.

  3. paul3654 says:

    @computersforfood

    Are you for real? This guy produced this work on his own time for FREE. You are so far up your own arse its unreal.

    Thanks for taking the time Karl it really helped me alot.

  4. pattormey says:

    First I love the in the Box idea!.. Hands down it’s great.
    OK that was the nice part..

    From Content
    I wish you hadn’ t picked an event planner as the sample. I been reluctant to move to MVVM because I don’t have a picture in my head of the event model (Starting to see my point) When I see a method called public Event GetById() I first read it as a list of well you know events!.. I think to myself.. WOW they keep an event queue as a list, must be some fancy ASYNC control.

    It’s not a killer thing but as an ‘MVVM no-nothing’ it is confusing.
    Pat NH USA

  5. Beautiful. Very, very helpful for teams getting started with this pattern. Thank you.

  6. Karl,
    I checked out the imlementation of DialogInteractionRequest in the kit and I fount it very cool on handling simple notification and confirmation message.

    What’s about handling a custom dialog with textboxes, buttons, etc. with his own viewmodel behind?

    I did a try rewriting the NotificationLocalInteractionDialog removing all the panels and buttons and leaving just the first gray grid, the rectangle, the border and the ContentControl, just to have the possibility to display a custom content on it, then when raising the request I instantiated the ViewModel and I passed it as a content of the notification.

    I used a data template definition to tie the viewmodel and the view to be displayed defined as a user control, this way I have the viewmodel as datacontext of the view so I can easly bind controls in the view to properties in the viewmodel.

    To some extend it works but I am having some difficulties on interacting with the dialog from the viewmodel, for example when I want to close the dialog from a command defined in the viewmodel.

    Am I doing something too complicated and is there any simpler way to realize this? Do you have any example on how to achieve it, maybe exenting the In The Box MVVM Training?

    The perfect scenario would be having the view to be displayed as a dialog defined as usercontrol and its related viewmodel to be tied together in some way.

    Thanks
    Antonio

  7. Karl says:

    Antonio,

    Prism does not provide the UI for a WPF interaction request out of the box. When I implemented the UI example for In the Box, I wrote the UI with the assumption that it would be used as a Message Box; this was done so that I didn’t have to implement the UI for a message box in each form.

    You should leave the above implementation as is so you can have message boxes.

    Have a look at the Silverilght implementation of the interaction request in Prism. This implementation does what you want. It is data template based. Just create another interaction request that uses data templates like the Silverlight implementation and expose this new request on the forms you need it.

    Cheers,

    Karl

Follow

Get every new post delivered to your Inbox.

Join 145 other followers