2012-03-16 9 views
3

TabControlのパディングプロパティは古典的なテーマではレンダリングされませんが、lunaテーマでは機能する理由は誰にも分かりますか?TabControlのパディングは古典的なテーマでは機能しません

Classic

Luna

XAMLは非常に基本的です。私はスクリーンショットで問題が明らかになるように、左側のパディングを50にしました。

<!-- Tab control styling --> 
     <Style TargetType="{x:Type TabControl}"> 
      <Setter Property="BorderBrush" Value="Black" /> 
      <Setter Property="BorderThickness" Value="1,1,1,1" /> 
      <Setter Property="Padding" Value="50,5,10,5" /> 
      <Setter Property="Margin" Value="3.5" /> 
      <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" /> 
     </Style> 

私は欠けている古典的なテーマについて何かありますか?すべてのパディングは無視されますか?

答えて

4

ShowMeTheTemplateまたはMicrosoft Expression Blendのいずれかのツールを使用すると、Microsoftがさまざまなテーマに対してデフォルトで実装しているコントロールテンプレートを調べることができます。 Windowsクラシックの場合

、TabControlののコントロールテンプレートは次のようになります。ルナのために

<ControlTemplate TargetType="{x:Type TabControl}"> 
    <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local"> 
     ... 
     <TabPanel .../> 
     <Grid ...> 
      <Microsoft_Windows_Themes:ClassicBorderDecorator ...> 
       <ContentPresenter x:Name="PART_SelectedContentHost" Margin="2,2,2,2" .../> 
      </Microsoft_Windows_Themes:ClassicBorderDecorator> 
     </Grid> 
    </Grid> 
    <ControlTemplate.Triggers> 
     ... 
    </ControlTemplate.Triggers> 
</ControlTemplate> 

、それは次のように:ルナで

<ControlTemplate TargetType="{x:Type TabControl}"> 
    <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local"> 
     ... 
     <TabPanel .../> 
     <Border ...> 
      <ContentPresenter x:Name="PART_SelectedContentHost" Margin="{TemplateBinding Padding}" .../> 
     </Border> 
    </Grid> 
    <ControlTemplate.Triggers> 
     ... 
    </ControlTemplate.Triggers> 
</ControlTemplate> 

、TabControlののパディング、マージンにバインドされていますContentPresenterのWindows Classicでは、余白は2に設定されています。

個人的には、これはバグです。 http://connect.microsoft.com/に関するバグレポートを作成することができます。

<TabControl> 
    <TabControl.ContentTemplate> 
     <DataTemplate> 
      <ContentPresenter Content="{Binding}" Margin="50,5,10,5"/> 
     </DataTemplate> 
    </TabControl.ContentTemplate> 
    ... 
<TabControl> 
:回避策として

、独自のコンテンツテンプレートを定義することができます

関連する問題