i want localize app bar have made in app.xaml when try bind text of bar item says text cannot empty , have tried other examples of localized app bar none of them working app bar can used on pages..
you can declare global app bar in app.xaml fake text, example:
<application     x:class="phoneapp1.app"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      xmlns:shell="clr-namespace:microsoft.phone.shell;assembly=microsoft.phone">      <!--application resources-->     <application.resources>         <local:localizedstrings xmlns:local="clr-namespace:phoneapp1" x:key="localizedstrings"/>         <shell:applicationbar x:key="globalappbar">             <shell:applicationbariconbutton text="test" iconuri="/assets/check.png"/>         </shell:applicationbar>     </application.resources>      <application.applicationlifetimeobjects>         <!--required object handles lifetime events application-->         <shell:phoneapplicationservice             launching="application_launching" closing="application_closing"             activated="application_activated" deactivated="application_deactivated"/>     </application.applicationlifetimeobjects>  </application> in app.xaml.cs apply localization:
    var appbar = app.current.resources["globalappbar"] applicationbar;     ((applicationbariconbutton) appbar.buttons[0]).text = appresources.appbarbuttontext; now can use global appbar everywhere in app, initializing  in code behind of phoneapplicationpage:
public mainpage() {     initializecomponent();     applicationbar = app.current.resources["globalappbar"] applicationbar; } 
Comments
Post a Comment