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 813421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:21:24+00:00 2026-05-15T01:21:24+00:00

This is my ViewModel Code: vb: Public Property Doctor() As Doctor Get Return _objDoctor

  • 0

This is my ViewModel Code:
vb:

Public Property Doctor() As Doctor
        Get
            Return _objDoctor
        End Get
        Set(ByVal Value As Doctor)
            _objDoctor = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property AddDate() As Nullable(Of DateTime)
        Get
            Return _objDoctor.AddDate
        End Get
        Set(ByVal Value As Nullable(Of DateTime))
            _objDoctor.AddDate = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property AddUserID() As String
        Get
            Return _objDoctor.AddUserID
        End Get
        Set(ByVal Value As String)
            _objDoctor.AddUserID = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property ChangeDate() As Nullable(Of DateTime)
        Get
            Return _objDoctor.ChangeDate
        End Get
        Set(ByVal Value As Nullable(Of DateTime))
            _objDoctor.ChangeDate = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property ChangeUserID() As String
        Get
            Return _objDoctor.ChangeUserID
        End Get
        Set(ByVal Value As String)
            _objDoctor.ChangeUserID = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property CollaboratingPhysicianID() As Nullable(Of Int64)
        Get
            Return _objDoctor.CollaboratingPhysicianID
        End Get
        Set(ByVal Value As Nullable(Of Int64))
            _objDoctor.CollaboratingPhysicianID = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property CredentialsID() As Int64
        Get
            Return _objDoctor.CredentialsID
        End Get
        Set(ByVal Value As Int64)
            _objDoctor.CredentialsID = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property DisplayName() As String
        Get
            Return _objDoctor.DisplayName
        End Get
        Set(ByVal Value As String)
            _objDoctor.DisplayName = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property DoctorSpecialtyID() As Int64
        Get
            Return _objDoctor.DoctorSpecialtyID
        End Get
        Set(ByVal Value As Int64)
            _objDoctor.DoctorSpecialtyID = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property FirstName() As String
        Get
            Return _objDoctor.FirstName
        End Get
        Set(ByVal Value As String)
            _objDoctor.FirstName = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property ID() As Int64
        Get
            Return _objDoctor.ID
        End Get
        Set(ByVal Value As Int64)
            _objDoctor.ID = Value
            OnPropertyChanged("Doctor")
        End Set
    End Property

    Public Property LastName() As String
        Get
            Return _objDoctor.LastName
        End Get
        Set(ByVal Value As String)
            _objDoctor.LastName = Value
            OnPropertyChanged("LastName")
        End Set
    End Property

Here is on example of XAML that I could use:

<StackPanel>
        <TextBox Text="{Binding LastName}" />
        <TextBox Text="{Binding Doctor.LastName}" />
    </StackPanel>

I would really prefer to bind to my data as the first textbox is so that I can do validation on changes. (if there is a way to do validation with the second way someone please let me know)

The problem is this:

If I load the doctor in the new constructor of the viewmodel as such:

Public Sub New()
    If IsInDesignMode Then
    Else
        CreateEventSubscriptions()
    End If
    Me.Doctor = DoctorService.GetDoctor(4839)

End Sub

The Databinding works correctly the first time. But if I try to change the associated doctor with an Event, only the doctor.lastname binding works.

    Private Sub onEdit(ByVal d As Doctor)
        Me.Doctor = DoctorService.GetDoctor(d)


    End Sub

I know I dont need to load a doctor from my service because I am actually passing the doctor…I was trying to see if there was something magical about using a service to fill the propery.

I got the code for my viewmodel properties using Karl Shifflet’s XAML PowerToys. Knowing that Karl knows what he is doing I am not sure why I cant get this to work….hopefully it is something silly I am missing.

  • 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-05-15T01:21:25+00:00Added an answer on May 15, 2026 at 1:21 am

    I believe if you change the doctor during an event, you should also call:

    OnPropertyChanged("LastName")
    

    Otherwise I don’t think the binding code has any way of knowing the LastName property has been updated.

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

Sidebar

Related Questions

No related questions found

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.