locked
mvvm RRS feed

  • Question

  • hy.
    I would use the vmmv in my wpf project.
    The problem is that i find a lot of generic or graphics documentation,
    any, but none on the mvvm pattern
    I have searched in google and i saw that there are a lot of mvvm framework for the wpf,
    can you give me an advice a good framework with documentation?
    thanks.
    Friday, December 31, 2010 3:52 PM

Answers

  • I am using Cinch framework for my projects,it is an open source project my sachabarber. it have everything that you probebly need, supports Validation, IoC and a lot more,most importently he is answering most of the queries in one day time :) try this site cinch.codeplex.com, there are other frameworks too, like Calcium, Caliburn, and MVVMToolkit by Josh smith.
    mark my post as answer if my post was usefull to you
    • Proposed as answer by MarkoVermeer Sunday, January 2, 2011 8:24 PM
    • Marked as answer by Min Zhu Thursday, January 6, 2011 1:34 AM
    Friday, December 31, 2010 4:06 PM
  • Hi guiseppe500,

    I would recommend MVVM Light toolkit:
    http://mvvmlight.codeplex.com/

    You can also look at PRISM if you are planning a bigger size of a project.
    http://msdn.microsoft.com/en-us/library/gg406140.aspx

    Thanks,
    Muhammad 


    Muhammad Siddiqi
    • Proposed as answer by MarkoVermeer Sunday, January 2, 2011 8:24 PM
    • Marked as answer by Min Zhu Thursday, January 6, 2011 1:34 AM
    Friday, December 31, 2010 4:22 PM
  • Frameworks are good, but your should understad the basics before using frameworks.  Here is a simple MVVM implementation:

    Create the ViewModel:

     public class SimpleViewModel : INotifyPropertyChanged
     {
      private string _message;
      public string Message
      {
       get { return _message; }
       set
       {
        _message = value;
        OnPropertyChanged("Message");
       }
      }
    
    
      public SimpleViewModel()
      {
       Message = "Hellow from the ViewModel";
      }
      
    
      public event PropertyChangedEventHandler PropertyChanged;
      public void OnPropertyChanged(string propertyName)
      {
       if (PropertyChanged != null)
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
     }
    

    Simple View:

    <Window x:Class="ForumSandbox.SimpleView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:ForumSandbox"
      Title="SimpleView" Height="300" Width="300">
    
     <Window.DataContext>
      <local:SimpleViewModel />
     </Window.DataContext>
     
     <Grid>
      <TextBlock Text="{Binding Message}" />
     </Grid>
    </Window>
    

    Pay attention to the xmlns:local namespace.  You need to point this to your namespace that contains the view model.  The magic occurs when you set the DataContext of the View to an instance of your ViewModel.  That is it.  That is how simple it is.

    • Proposed as answer by MarkoVermeer Sunday, January 2, 2011 8:24 PM
    • Marked as answer by Min Zhu Thursday, January 6, 2011 1:34 AM
    Friday, December 31, 2010 5:00 PM

All replies

  • I am using Cinch framework for my projects,it is an open source project my sachabarber. it have everything that you probebly need, supports Validation, IoC and a lot more,most importently he is answering most of the queries in one day time :) try this site cinch.codeplex.com, there are other frameworks too, like Calcium, Caliburn, and MVVMToolkit by Josh smith.
    mark my post as answer if my post was usefull to you
    • Proposed as answer by MarkoVermeer Sunday, January 2, 2011 8:24 PM
    • Marked as answer by Min Zhu Thursday, January 6, 2011 1:34 AM
    Friday, December 31, 2010 4:06 PM
  • Hi guiseppe500,

    I would recommend MVVM Light toolkit:
    http://mvvmlight.codeplex.com/

    You can also look at PRISM if you are planning a bigger size of a project.
    http://msdn.microsoft.com/en-us/library/gg406140.aspx

    Thanks,
    Muhammad 


    Muhammad Siddiqi
    • Proposed as answer by MarkoVermeer Sunday, January 2, 2011 8:24 PM
    • Marked as answer by Min Zhu Thursday, January 6, 2011 1:34 AM
    Friday, December 31, 2010 4:22 PM
  • Frameworks are good, but your should understad the basics before using frameworks.  Here is a simple MVVM implementation:

    Create the ViewModel:

     public class SimpleViewModel : INotifyPropertyChanged
     {
      private string _message;
      public string Message
      {
       get { return _message; }
       set
       {
        _message = value;
        OnPropertyChanged("Message");
       }
      }
    
    
      public SimpleViewModel()
      {
       Message = "Hellow from the ViewModel";
      }
      
    
      public event PropertyChangedEventHandler PropertyChanged;
      public void OnPropertyChanged(string propertyName)
      {
       if (PropertyChanged != null)
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
     }
    

    Simple View:

    <Window x:Class="ForumSandbox.SimpleView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:ForumSandbox"
      Title="SimpleView" Height="300" Width="300">
    
     <Window.DataContext>
      <local:SimpleViewModel />
     </Window.DataContext>
     
     <Grid>
      <TextBlock Text="{Binding Message}" />
     </Grid>
    </Window>
    

    Pay attention to the xmlns:local namespace.  You need to point this to your namespace that contains the view model.  The magic occurs when you set the DataContext of the View to an instance of your ViewModel.  That is it.  That is how simple it is.

    • Proposed as answer by MarkoVermeer Sunday, January 2, 2011 8:24 PM
    • Marked as answer by Min Zhu Thursday, January 6, 2011 1:34 AM
    Friday, December 31, 2010 5:00 PM