silverlight - How to display application title in XAML text field -
silverlight - How to display application title in XAML text field -
i have windows phone page code shared multiple applications.
at top of page, show title of application, so:
is possible create text bound application title defined in application's assembly?
i realise code reading title in assembly , doing like:
this.applicationtitle.text = title;
i hoping title defined in assembly accessed magic like:
text={assembly title}" straight within xaml.
thanks
create property called applicationtitle returns name of application following, , bind in xaml:
public string applicationtitle { { homecoming system.reflection.assembly.getexecutingassembly().getname().name; } }
(you can utilize relative binding source if can't or don't want utilize info context.)
edit:
i realized method involved security considerations since getname method [security critical]. , got methodaccessexception stating: effort access method failed: system.reflection.assembly.getname()
so here's way assembly name , homecoming in property using assemblytitle attribute.
public string applicationtitle { { system.reflection.assemblytitleattribute ata = system.reflection.assembly.getexecutingassembly().getcustomattributes( typeof(system.reflection.assemblytitleattribute), false)[0] system.reflection.assemblytitleattribute; homecoming ata.title; } }
to bind in xaml, can utilize this:
text="{binding elementname=layoutroot, path=parent.applicationtitle}"
silverlight windows-phone-7
Comments
Post a Comment