Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 826
Benjol Avatar asked Sep 28 '09 10:09

Benjol


2 Answers

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).

like image 189
Drew Noakes Avatar answered Oct 16 '22 20:10

Drew Noakes


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

like image 6
Kent Boogaart Avatar answered Oct 16 '22 21:10

Kent Boogaart