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

  • Home
  • SEARCH
  • 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 518137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:54:23+00:00 2026-05-13T07:54:23+00:00

I’m working on WPF based application. Environment is VS2008 SP1 with .NET 3.5 SP

  • 0

I’m working on WPF based application. Environment is VS2008 SP1 with .NET 3.5 SP 1.
In our development we are using MVVM pattern widely.

I.e. application developers write Models and ViewModels (C#), then UI developers will write Views using WPF Binding (XAML). Application developers also write unit tests on top of ViewModels.
We are using Continuous Integration methodology and we are diond build and executing unit test on each modification

The problem is a lack of process or tools of data binding correctness validation in XAML.
For example:

  1. App developer writes property NmberOfApples and unit tests to check its correct behavior
  2. UI developer creates user control and bind it to the property
  3. App developer finds that property has misspelling and fix its name to NumberOfApples
  4. It would be compilation time errors in any C# code uses NmberOfApples property, and such errors will be easy to catch (Continuous Integration)
  5. Data binding in XAML files are not going to be validated and it will be run time error

My question will be “Is there any tool or methodology that help us validate data binding correctness in XAML in compile time?”

  • 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-13T07:54:23+00:00Added an answer on May 13, 2026 at 7:54 am

    A solution to your problem is discussed in this article.

    The basic idea is to create a ViewModel MetaData set of static(c#) classes that hold the string value of the properties of your ViewModel classes which you can then use in your xaml. The article explains how to use T4 text generation to create these static metadata classes. You could use any code generation tool of your preference.

    so your VM has the following:

    namespace Mine
    {
      public class MyViewModel
      {
        public int MyInt {get;set;}
       public string MyString {get;set;}  
      }
    }
    

    And you code generation would create this:

    namespace Mine.MetaData
    {
      public static class MyViewModelMetaData
      {
        public const string MyInt = "MyInt";
        public const string MyString = "MyString";
      }
    }
    

    and then in your xaml you would add the namespace to your xaml and bind your controls to the metadata class

    <TextBox Text="{Binding Path={x:Static Metadata:MyViewModelMetadata.MyInt}}"/>
    

    If you use an add-in like resharper then it will give you intellisense on the properties of the static class and also because you are referencing an exact property in a static class, when the static class gets regenerated your xaml should not compile.

    It’s pretty slick, I think it’s awesome and it has the chance of keeping most people sane, but your mileage may vary. 🙂

    EDIT:

    By the way, I don’t buy the “ViewModels are tightly coupled to the Views”. In my opinion Views are inextricably bound to their ViewModels, but it should only be one way. ViewModels should be completely independent of any view implementation. It’s like the ViewModel is the interface and the View is the concrete implemented class. So for this reason I don’t put in any WPF-specific properties(e.g. Visibility enumeration) into my ViewModel because that binds me to use WPF for eternity(which isn’t really a bad thing 🙂 ), but it compromises maintenance.

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

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The modern C++ equivalent would be a sentry object: construct… May 14, 2026 at 9:01 am
  • Editorial Team
    Editorial Team added an answer If it helps, Yisroel, you can think of the object… May 14, 2026 at 9:01 am
  • Editorial Team
    Editorial Team added an answer Try adding an onsubmit to your form tag: <form action="enterdb.php"… May 14, 2026 at 9:01 am

Related Questions

I'm working on a page based WPF application, and I want to change the
I'm working on a new C# application using WPF. I was under the impression
I'm working on a simple application to start learning my way around WPF. I
I have a C# (2008/.NET 3.5) class library assembly that supports WPF (based on
I have a question and hopefully you can steer me in the right direction.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.