0

I want to have the AssemblyTitle change whenever I change the Title of the main window in WPF. Im not sure how to do this? Any suggestions? Can I do this in the XAML?

1 Answers1

0

AssemblyTitleAttribute.Title is readonly so this is not an option.

http://msdn.microsoft.com/en-us/library/system.reflection.assemblytitleattribute.title(v=vs.110).aspx

Pantelis
  • 2,060
  • 3
  • 25
  • 40
  • can I change the Assembly Title and then in turn it will change the Window Title? – user3362580 Jun 16 '14 at 18:24
  • No, you can only set it during build. – Pantelis Jun 16 '14 at 18:31
  • Is there a way to set the window title as the assembly title name when I build? I want to be able to change the assembly title name and then rebuild and have the window title change to the new assembly title. – user3362580 Jun 16 '14 at 18:48
  • Sure, if you're using MVVM just assign to a property the Assembly title and bind that property to the window title or if you're only working in code behind, set the window title in its constructor. – Pantelis Jun 16 '14 at 19:06
  • I tried doing this:Title = Application.Current.MainWindow.GetType().Assembly.GetName().Name; The only problem is that I need the Assembly Title in the Assembly Information and I keep getting the Assembly name. I apologize if i'm being confusing by the way. – user3362580 Jun 16 '14 at 20:37
  • You have to get the attribute off the assembly, it's not a property like GetName().Name. – Gayot Fow Jun 16 '14 at 21:17
  • You have to use System.Reflection. `AssemblyTitleAttribute title = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0] as AssemblyTitleAttribute;` `return title.Title;` – Pantelis Jun 16 '14 at 21:25