Click here to Skip to main content
15,884,537 members
Articles / Desktop Programming / WPF

MVVM for Multi Platforms

Rate me:
Please Sign up or sign in to vote.
4.13/5 (6 votes)
22 Mar 2010CPOL2 min read 26.4K   354   22  
How to implement MVVM when developing a view model whose view implementation language is not certain
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GeographicRepresentation.Lib.Model
{
    /// <summary>
    /// The country model class
    /// </summary>
    public class Country
    {
        #region Members

        Guid m_Id;
        string m_strName;
        int m_nSize;
        float m_fBirthRate;
        List<City> m_Cities;        

        #endregion

        #region Properties

        public Guid Id
        {
            get { return m_Id; }
            set { m_Id = value; }
        }

        public string Name
        {
            get { return m_strName; }
            set { m_strName = value; }
        }

        public int Size
        {
            get { return m_nSize; }
            set { m_nSize = value; }
        }


        public float BirthRate
        {
            get { return m_fBirthRate; }
            set { m_fBirthRate = value; }
        }

        /// <summary>
        /// A list of cities in the country
        /// </summary>
        public List<City> Cities
        {
            get { return m_Cities; }
            set { m_Cities = value; }
        }

        #endregion

        #region Ctor

        public Country()
        {
            m_Id = Guid.NewGuid();
            m_Cities = new List<City>();
        }

        public Country(Country country)
        {
            m_Id = country.Id;
            m_strName = country.Name;
            m_nSize = country.Size;
            m_fBirthRate = country.BirthRate;
            m_Cities = country.Cities;
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Israel Israel
Software Developer in a promising Clean-Tech company

Comments and Discussions