localization - More convenient way to localize in windows phone apps -
currently, if want localize application title in windows phone app this:
<textblock text="{binding localizedresources.applicationtitle, source={staticresource localizedstrings}}" />
this long, , parts repeated each binding. if rename localizedresources
property r
, localizedstrings
class ls
example, repetition still exist.
so tried making class inherits binding
class , implemented follows:
public class localizedbinding : binding { public localizedbinding(string path) : base(path) { source = application.current.resources["localizedstrings"]; } }
the hope use follows:
<textblock text="{b:localizedbinding localizedresources.applicationtitle}" />
however, app crashes upon start , can't see errors in debugger. tips on how might work?
thanks
edit:
adding parameterless constructor localizedbinding
, appending path=
binding fixes it.
this fixed adding parameterless constructor localizedbinding
class
public class localizedbinding : binding { public localizedbinding() { source = application.current.resources["localizedstrings"]; } public localizedbinding(string path) : base(path) { source = application.current.resources["localizedstrings"]; } }
Comments
Post a Comment