Scenario: You need to define a string value that needs to be reused across your application (eg: Application Title)
One way the above scenario can be implemented is by using the “Application.Resources” in the App.Xaml file.
The first step is to define the string resource. This is done by defining the type (clr:String) and a key that will be used to access the string. The value is also defined here:
<Application.Resources>
<clr:String x:Key="ApplicationTitle">OptiRoute</clr:String>
</Application.Resources>
The above resource can then be accessed in your XAML markup using StaticResource markup extension:
<TextBlock x:Name="ApplicationTitle" Text="{StaticResource ApplicationTitle}" Style="{StaticResource PhoneTextNormalStyle}"/>
No comments:
Post a Comment