Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9000231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:17:06+00:00 2026-06-16T00:17:06+00:00

I am new to deep coding like MVVM, on the page MSDN Simple MVVM

  • 0

I am new to deep coding like MVVM, on the page MSDN Simple MVVM page, Model class is defined without INotifyPropertyChanged, only the VIEWModelBase it is used.

Main Code is as follows (CODE is copied from the mentioned page):

Namespace SimpleMVVM.Model

    Public Class Customer
        Public Property CustomerID() As Integer 
        Public Property FullName() As String 
        Public Property Phone() As String 
    End Class 
End Namespace

Namespace SimpleMVVM.Model
    Public Class CustomerRepository
        Private _customers As List(Of Customer)

        Public Sub New()
            _customers = New List(Of Customer) From
            {
                New Customer() With {.CustomerID = 1, .FullName = "Dana Birkby", .Phone = "394-555-0181"},
                New Customer() With {.CustomerID = 2, .FullName = "Adriana Giorgi", .Phone = "117-555-0119"},
                New Customer() With {.CustomerID = 3, .FullName = "Wei Yu", .Phone = "798-555-0118"}
            }
        End Sub 

        Public Function GetCustomers() As List(Of Customer)
            Return _customers
        End Function 

        Public Sub UpdateCustomer(SelectedCustomer As Customer)
            Dim customerToChange = _customers.Single(Function(c) c.CustomerID = SelectedCustomer.CustomerID)
            customerToChange = SelectedCustomer
        End Sub 
    End Class 
End Namespace


Imports System.ComponentModel

Namespace SimpleMVVM.ViewModel

    Public MustInherit Class ViewModelBase
        Implements INotifyPropertyChanged

        Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

        Protected Overridable Sub OnPropertyChanged(propname As String)
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propname))
        End Sub 
    End Class 
End Namespace

Imports System.Collections.Generic
Imports SimpleMVVM.Model

Namespace SimpleMVVM.ViewModel

    Public Class CustomerViewModel
        Inherits ViewModelBase

        Private _customers As List(Of Customer)
        Private _currentCustomer As Customer
        Private _repository As CustomerRepository
        Private _updateCustomerCommand As RelayCommand

        Public Sub New()
            _repository = New CustomerRepository()
            _customers = _repository.GetCustomers()

            WireCommands()
        End Sub 

        Private Sub WireCommands()
            UpdateCustomerCommand = New RelayCommand(AddressOf UpdateCustomer)
        End Sub 

        Public Property UpdateCustomerCommand() As RelayCommand
            Get 
                Return _updateCustomerCommand
            End Get 
            Private Set(value As RelayCommand)
                _updateCustomerCommand = value
            End Set 
        End Property 

        Public Property Customers() As List(Of Customer)
            Get 
                Return _customers
            End Get 
            Set(value As List(Of Customer))
                _customers = value
            End Set 
        End Property 

        Public Property CurrentCustomer() As Customer
            Get 
                Return _currentCustomer
            End Get 
            Set(value As Customer)
                If _currentCustomer.Equals(value) Then
                    _currentCustomer = value
                    OnPropertyChanged("CurrentCustomer")
                    UpdateCustomerCommand.IsEnabled = True 
                End If 
            End Set 
        End Property 

        Public Sub UpdateCustomer()
            _repository.UpdateCustomer(CurrentCustomer)
        End Sub 
    End Class 
End Namespace
  1. My question is does the effect of INotifyPropertyChanged effect be the same for INotifypropertychanged being implemented on each property within the class customer compared to that Inotifyproperty implemented on CustomerOBject in viewmodelbase.

  2. In the second case when the customer object only one property value is modified like CurrentCustomer.FullName=”asdasd” does raise Inotifypropertychanged event per property?

  3. Can Viewmodelclass be sent over WCF like a datacontract, or datacontract is only for Modelclass without InotifyPropertyChanged

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:17:07+00:00Added an answer on June 16, 2026 at 12:17 am

    I’ll try to answer your questions:

    1. Implement INotifyPropertyChanged on your class/view model. All property’s that you want to send out a notification for must call OnPropertyChanged(“YourPropertyName”);

    2. No, only the property that was changed is effected, provided it calls OnPropertyChanged(“YourPropertyName”);

    3. You can send a view-model provided it’s attributed with [DataContract], but you really should be doing that with your models.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a DBM::Deep hash object like so: my $dbm = DBM::Deep->new( file
new to c#. I'm trying to make a simple system where I can search
I'm new to python and kind of been chucked in the deep end at
I am knee deep in starting a new ASP.NET MVC project. Several tutorials have
I'm new to development and particularly C#. Been thrown in the deep end here
I want to create a new application. It will basically be a Deep Zoom
I am relatively new Java developer that's been thrown in the deep end, my
I am new to the world of PHP and coding as those have helped
A deep model is code-generated with lots of arrays (think WCF proxy genererated code
So i want to try a new concept that involves deep modifications of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.