silverlight - Get the Windows Phone 7 Application Title from Code -
I want to use the title value stored in my WMAppManifest.xml file with my ViewModel code. This is the same application title, which is set up through project properties.
Is there a way to use it with code using something like app.corrent?
See WP7DataCollector.GetAppAttribute () GetAppAttribute ("title") will do this.
/// & lt; Summary & gt; /// Windows Phone App Manifest App attaches a feature from the aliases /// & lt; / Summary & gt; /// & lt; Param name = "attributeName" & gt; Attribute name & lt; / Param & gt; /// & lt; Returns & gt; Attribute Value & lt; / Returns & gt; Private Static String GetAppAttribute (string attribute name) {string appManifestName = "WMAppManifest.xml"; String appNodeName = "app"; Var Settings = New XmlReaderSettings (); Settings.XmlResolver = New XmlXapResolver (); (Using XmlReader rdr = XmlReader.Create (appMinifestName, settings)) {rdr.ReadTesDescendant (appNodeName); If (! Rdr.IsStartElement ()) {throw the new system. Exception (appMinifestName + "" is missing + AppNodeName); } Return rdr.GetAttribute (attributeName); }}
Comments
Post a Comment