windows phone 8 - Why not use AppResources directly -
i'm writng large localized windows phone 8 application. when open blank wp8 project. generates appresources.resx file , localizedstrings class.
localizedstrings class used hold static appresources field , nonstatic accessor field. , in resources of app.xaml localizedstrings added follows:
<local:localizedstrings xmlns:local="clr-namespace:projectns" x:key="localizedstrings"/>
and used in pages as:
text="{binding localizedresources.applicationtitle, source={staticresource localizedstrings}}"
instead of default use, below solution works:
in app.xaml:
<local:appresources xmlns:local="clr-namespace:projectns.resources" x:key="appresources"/>
in pages:
text="{binding applicationtitle, source={staticresource appresources}}"
so why don't use below one? because has 1 less class(localizedstrings not needed) , when use localized strings in pages shorter (you don't need write "localizedresources.some_string" time, write "some_string")
is there wrong solution can't see?
Comments
Post a Comment