WPF C# Desktop App - Build date from the application

Markus Freitag 3,791 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?

Developer technologies | Windows Presentation Foundation
0 comments No comments
{count} votes

Answer accepted by question author
  1. Peter Fleischer (former MVP) 19,341 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,791 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,791 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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.