DanT
DanT

Reputation: 4180

Best practices to avoid binding errors

Do you know a systematic approach to avoid binding errors in WPF projects?

As they grow it's getting impractical to rely on the output window and it is a pain while refactoring, that you can easily break bindings by renaming properties in the view model.

Right now I'm using a complex procedure of exposing the property paths as static properties and use them in my binding. This way resharper helps me renaming the static references to my properties, if i rename them.

I consider to switch to this approach to get an easier procedure. But I would loose the renaming assistance of resharper by this.

Is it worthwhile? Do you have better patterns?

Upvotes: 4

Views: 337

Answers (1)

Sean U
Sean U

Reputation: 6850

ReSharper helps here somewhat. If it can figure out the type for an element's DataContext, then it will verify that you're binding to properties that actually exist. If it can't figure out the type, it will prompt you to set a d:DataContext for the element.

Upvotes: 1

Related Questions