DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Languages
  4. Easy MVVM Examples (In Extreme Detail) Available

Easy MVVM Examples (In Extreme Detail) Available

Greg Duncan user avatar by
Greg Duncan
·
Sep. 15, 12 · Interview
Like (0)
Save
Tweet
Share
17.44K Views

Join the DZone community and get the full member experience.

Join For Free

Microsoft Developer Network - Easy MVVM Example

"This project will give you crash course on WPF MVVM that you can do in your lunch break! Everything you need to know about binding, INotifyPropertyChanged, Dependency Objects & Properites, POCO objects, Business Objects, Attached Properties and much more!

image..."

Easy MVVM examples (in extreme detail)

This article discusses the various methods and tricks used in MVVM to enable a developer to completely separate the user interface from the code.

Table of Contents

  • Introduction
  • Classic INotifyPropertyChanged
    • Switching windows from traditional event handlers in code-behind
  • DataContext Made in Code
    • Closing Windows from the ViewModel
  • Using DependencyObject instead of INPC
    • Controlling an Application through CanExecute
    • Closing with a Attached Property via Dependency Property
  • Using POCO objects with MVVM
    • Custom Event Self-close Hack
    • Tweaking one property to show the difference
    • A Cleaner 'Interface' Way to Close the Window
  • How to consume a closed Business Object (database layer, web service)
    • Wrapping POCOs
    • Polling POCOs
    • Virtually Codeless Master/Detail CRUD Control
      • How to bind and when to update
      • Create, Update, Delete Logic

Introduction

Model View ViewModel is the golden child of WPF, allowing a developer to completely separate their application code from any UI dependencies.

This means an application can be easily be re-skinned and it also makes an application much easier to test.

The View represents any front-end user interface controls (Window, Page, UserControl), the model represents the classes used in the application, and the ViewModel is the middle-man that requests, molds and exposes the data, as properties and commands.

This is article is linked to a TechNet sample project that you can download and explore. It covers many basic concepts of MVVM, and some of the common pitfalls and solutions.

image..."

This is one of those helper articles for those that have been meaning to look into/learn/grok MVVM but haven't yet found the time too.
application Property (programming) Object (computer science) Microsoft Developer Network Table of contents dev Dependency Interface (computing) Event

Published at DZone with permission of Greg Duncan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The 12 Biggest Android App Development Trends in 2023
  • Asynchronous HTTP Requests With RxJava
  • Remote Debugging Dangers and Pitfalls
  • How Observability Is Redefining Developer Roles

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: