Get the Windows Phone 7 Application Title from Code

后端 未结 5 674
失恋的感觉
失恋的感觉 2020-12-28 21:27

I want to access the Title value that is stored in the WMAppManifest.xml file from my ViewModel code. This is the same application title that is set through the project prop

5条回答
  •  别那么骄傲
    2020-12-28 21:58

    This last answer seems overly complicated to me ; you could have simply done something like:

                    string name = "";
                    var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
                    var customAttributes = executingAssembly.GetCustomAttributes(typeof(System.Reflection.AssemblyTitleAttribute), false);
                    if (customAttributes != null)
                    {
                        var assemblyName = customAttributes[0] as System.Reflection.AssemblyTitleAttribute;
                        name = assemblyName.Title;
                    }
    

提交回复
热议问题