4

what are the common mistake can be avoided by a WPF developer?

Kishore Kumar
  • 21,449
  • 13
  • 81
  • 113

6 Answers6

4

I think a big mistake would be to ignore the M-V-VM Pattern that should be used by good developers

Mohnkuchenzentrale
  • 5,745
  • 4
  • 30
  • 41
3

Treating it like Windows Forms.. Don't do that.. WPF != WinForms..

Arcturus
  • 26,677
  • 10
  • 92
  • 107
  • 5
    Sadly most of the WPF Books doesn't even write about the MVVM Pattern to use with WPF. They all write their samples like they were Winforms ... – Mohnkuchenzentrale Jun 10 '10 at 08:33
2

Putting code (validation, coercion logic, change notifications, logging, etc) in the getters and setters of dependency properties' corresponding CLR properties, instead of using the PropertyChangedCallback, ValidateValueCallback and CoerceValueCallback.

Normal .NET code can get or set the property values through them, but WPF gets and sets these values by going directly to the backing store.

The CLR wrapper should thus look like this:

public int Prop
{
  get
  {
    /*NOTHING IN HERE*/

    return (int)GetValue(ThingyProperty);
  }

  set
  {
    /*NOTHING IN HERE*/

    SetValue(ThingyProperty, value);

    /*NOTHING IN HERE*/
  }
}
luvieere
  • 37,065
  • 18
  • 127
  • 179
1

Over-engineering... just because it is possible to do with a complex binding doesn't mean you can maintain it...

EDIT: And doing things in XAML that should be done elsewhere.

Goblin
  • 7,970
  • 3
  • 36
  • 40
0

Check this out -

What are the most common mistakes made in WPF development? What are the most common mistakes made in WPF development?

Community
  • 1
  • 1
akjoshi
  • 15,374
  • 13
  • 103
  • 121
0
  • Treating it like Windows Forms or ASP.NET
  • Ignoring the MVVM Pattern
  • Overusing the MVVM pattern in sake of MVVM pattern
  • Treating it like Silverlight
  • Ignoring XAML coding guidelines -> result in unmaintainable XAML.
  • Ignoring Binding errors in Visual Studio Output
  • Ignoring Designer in Visual Studio (i.e. WPF application blendability)
PScr
  • 449
  • 2
  • 11
Anvaka
  • 15,658
  • 2
  • 47
  • 56