One of our major projects recently used WPF 4.0 with MVVM pattern.We used the MVVM Light Toolkit for implementing the MVVM Pattern. The MVVM Light Toolkit definitely has a lot to offer to make your life easier but the documentation is not exemplary! Few things we learnt down the road as we came to a […]
Tag Archives: MVVM
Commanding within DataTemplates in MVVM!
A quick post about setting commands within DataTemplates when using the MVVM pattern! When you are inside a DataTemplate the DataContext is changed to the the current item, so to access the command you will need to use the “relative source” Something like <Button Content=”Delete” Width=”Auto” Command=”{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}” CommandParameter=”{Binding}”> Hope this […]