Hi
Please look at this sample.
I have a silverlight project. it has a style file that merged with app.xaml
My global style :
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="TextBlock">
<Setter Property="FontFamily" Value="Tahoma" />
</Style>
</ResourceDictionary>
I Merged it to app.xaml :
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SilverlightApplication1.App"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Style.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
It has a MainPage :
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" removed="White">
<TextBlock Height="23" HorizontalAlignment="Left" Margin="41,51,0,0" Name="textBlock1" Text="ABC" VerticalAlignment="Top" />
<Button Height="23" HorizontalAlignment="Left" Margin="41,80,0,0" Name="button1" VerticalAlignment="Top" Width="75" >
<Button.Template>
<ControlTemplate>
<Border>
<TextBlock Text="ABC" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</UserControl>
in My MianPage I have a textBlock and a button with Template.
My global style apply on the TextBlock but do not apply on textblock that is
in the DateTemplete for button.
How can I solve this problem that global style apply on the element on DataTemplte ?
Thanls a lot