top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Explain windows phone Implicit Style and Explicit Style?

+1 vote
360 views
Explain windows phone Implicit Style and Explicit Style?
posted Jun 17, 2015 by Puhal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Styles makes life easier ,you can reuse them within the entire Application.And it is very best practices styles can included in App.xaml page to available for entire application.

Implicit Style:

Here created style need not to have key identifier and you don't need to specify key identifier when you use this kind of style.

<Application.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="FontSize" Value="8" />
        </Style>
</Application.Resources>

Here you don't have to specify the style for the TextBlock , it will automatically pick the above style when you created TextBlock in your application.

Explicit Style:

Here created style must have key identifier and you must specify that key identifier when you use this kind of style.

For example ,

The developers can create a style for the textblock with a key identifier in the app.xaml file and then reuse them in different screens of the application.

 <Application.Resources>
        <Style x:Key="MyCustomStyle" TargetType="TextBlock">
            <Setter Property="FontSize" Value="8" />
        </Style>
</Application.Resources>

The above style is for the textblock is given a name with the key attribute "x:Key="MyCustomStyle" . To refer to this style for a textblock , use the sample code for the textblock as shown below.

<TextBlock Name="Txtblk" Style="{StaticResource MyCustomstyle}"/>
answer Jun 18, 2015 by Jdk
...