6 Tips of Separation: Listing 4.

The XAML and data binding for PersonViewModel with ViewModelField<T>.

<StackPanel>
  <controls:TextboxField
    DataContext="{Binding Id}"
    LabelText="Salary"/>
  <controls:TextboxField
    DataContext="{BindingFirstName}"
    LabelText="First Name"/>
  <controls:TextboxField
    DataContext="{BindingLastName}"
    LabelText="Last Name"/>
  <controls:TextboxField
    DataContext="{BindingEmailAddress}"
    LabelText="Email Address"/>
  <controls:TextboxField
    DataContext="{Binding Salary}"
    LabelText="Salary"/>
</StackPanel>

About the Author

Benjamin Day is a consultant, trainer, and author specializing in software development, project management, and leadership. Ben’s main areas of emphasis include Azure DevOps, C#, Angular, Scrum, software testing, and software architecture. He is a Microsoft MVP, a certified Scrum trainer via Scrum.org, and speaks regularly at VSLive. His online courses are available at YouTube and at http://www.pluralsight.com. Ben is also the founder of https://SlideSpeaker.ai. He can be contacted via http://www.benday.com.

comments powered by Disqus

Featured

Subscribe on YouTube