Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to bind a TextBlock's Text to an applications AssemblyVersion?

If I have a TextBlock in the corner of my UserControl is it possible to bind the Text property to my Assembly Version Number Which is in AssemblyInfo.cs

WPF:

<TextBlock Text="{Binding AssemblyVersion}"/>

AssemblyInfo.cs

[assembly: AssemblyVersion("1.0.0.0")]
like image 253
User1 Avatar asked Oct 23 '25 19:10

User1


1 Answers

Create a readonly property named AssemblyVersion and bind it.

public Version AssemblyVersion
{
    get
    {
        return Assembly.GetEntryAssembly().GetName().Version;
    }
}
like image 196
Sriram Sakthivel Avatar answered Oct 26 '25 09:10

Sriram Sakthivel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!