Benjol
Benjol

Reputation: 66577

Binding to AssemblyVersion in XAML (for Help/About dialogue)

Maybe I'm expecting too much here, but I figure I can't be the first person to have tried. Do I have to create (yet another) converter for this?

Upvotes: 12

Views: 11991

Answers (2)

Kent Boogaart
Kent Boogaart

Reputation: 178740

Not if you're using MVVM. Just expose a Version property from your view model and bind to that.

Upvotes: 6

Drew Noakes
Drew Noakes

Reputation: 311127

Accessing the current assembly's version requires method calls, so you can't do it with WPF binding:

Version version = Assembly.GetExecutingAssembly().GetName().Version;

Either use a converter (as you suggest), or create a property on your view model (as Kent suggests).

Upvotes: 14

Related Questions