2012-09-03 48 views
1

在我的App.xaml全局樣式不能被重寫

<Style TargetType="{x:Type TextBlock}"> 
    <Setter Property="FontSize" Value="12"></Setter> 
    <Setter Property="FontFamily" Value="Cailibri"></Setter> 
</Style> 

我有這樣的定義和Window1.xaml

<Style x:Key="BASE"> 
      <Setter Property="Control.FontSize" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=MyFontSize}"> 
      </Setter> 
      <Setter Property="Control.FontFamily" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=MyFontFamily}"> 
      </Setter> 
      <Setter Property="Control.HorizontalAlignment" Value="Left"> 
      </Setter> 
     </Style> 

<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BASE}"> 
     </Style> 

<Style TargetType="lc:LayoutItem" BasedOn="{StaticResource BASE}"> 
      <Setter Property="LabelStyle"> 
       <Setter.Value> 
        <Style TargetType="lc:LayoutItemLabel" BasedOn="{StaticResource BASE}"> 
        </Style> 
       </Setter.Value> 
      </Setter> 
     </Style> 

<lc:LayoutControl x:Name="HeadLayout" lc:LayoutControl.CustomizationLabel="test"  ItemInsertionPointIndicatorStyle="{StaticResource myInsertionPointIndicator}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
         AllowNewItemsDuringCustomization="False" AllowAvailableItemsDuringCustomization="True" Orientation="Horizontal"> 
<lc:LayoutGroup Orientation="Vertical" View="Group" Margin="0,0,0,0"  HorizontalAlignment="Stretch" VerticalAlignment="Top"> 
<lc:LayoutItem Label=" CDFEG " x:Name="StoreName" > 
    <TextBlock TextWrapping="Wrap" Text="ABCDEFG"/> 
    </lc:LayoutItem> 
</lc:LayoutGroup> 
</lc:LayoutControl> 

這個定義,當我改變字體大小或fontFamily中的財產,它TextBlock未在app.xaml中定義時正常工作。我已經搜索了很長時間,但對我來說沒有一個解決方案。任何建議都會有所幫助,thx。

+0

嘗試'