TAG: MVVM

Pass ListView SelectedItems to ViewModel in Universal apps

One of the things that WinRT devs need to work around in Universal apps is the fact that you can't bind straight to SelectedItems of a ListView/GridView. There are a few ways to pass SelectedItems to the ViewModel and here's one that can get the job done quickly. The method I'll use in this post uses EventTriggerBehavior to invoke a command in ViewModel when a SelectionChanged event occurs. For that to work, you need to…

MVVM Light session at Advanced Technology Days 10

I love talking about MVVM and encourage developers working with XAML platforms to at least explore it, learn more about it, and consider using it in whatever way works best for them and their team. I also love the simplicity of MVVM Light and how it's really easy to learn it and start using it quickly. I delivered a session at Microsoft Advanced Technology Days 10 event in Zagreb, Croatia, last week, and here's my presentation.…

Focus a TextBox from ViewModel using a simple behavior

Let's assume a simple scenario - you have a Windows Phone page connected to a ViewModel (VM) with everything bound nicely. A TextBox text property is connected to a string in VM, and when you change it, you wish to put focus on the TextBox. How to accomplish this considering that all your logic is actually in the VM separated from the View? Simply, using a focus behavior. Let's start with a simple UI. We have…

Microsoft Certified Solutions Developer: Windows Store Apps in C#