WPF C# Desktop App - Build date from the application

Markus Freitag 3,786 Reputation points
2020-09-15T14:32:16.763+00:00

Hello,

   private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            CurrentViewModel = (ViewModel)(this.Resources["vm"]);
            CurrentViewModel.InitFromMainWindow();

            this.Title = "Setting App/ (09/2020), " + Assembly.GetExecutingAssembly().GetName().Version.ToString();

How can I display the date of the exe on the title bar?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,697 questions
0 comments No comments
{count} votes

Accepted answer
  1. Peter Fleischer (former MVP) 19,306 Reputation points
    2020-09-15T17:47:54.943+00:00

    Hi Markus,
    bind property in Title and get the information like this:

            Title="{Binding Title}" Height="450" Width="800">
      <Window.DataContext>
        <local:ViewModel/>
      </Window.DataContext>
    

    ...

      public class ViewModel : INotifyPropertyChanged
      {
        public string Title { get => "Setting App/ (09/2020), " + File.GetCreationTime(Assembly.GetExecutingAssembly().Location).ToString(); }
    
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Markus Freitag 3,786 Reputation points
    2020-09-16T05:26:28.097+00:00

    Hi Peter,
    Please look.
    Is it possible to get the date of the EXE?
    25104-not-date-from-exe.png


  2. Markus Freitag 3,786 Reputation points
    2020-09-16T07:31:13.813+00:00

    25050--change-date.png

    I need the change date?
    But the Creation date, is which date? Can you get me an answer? Thanks.
    The project is older than 15.09.2020

    I think this is ok.
    24980-only.png

    0 comments No comments