2016-04-02 117 views
0

設計師恨開發商認爲他們爲什麼創造那麼weard設計!)) 所以,我的任務是創建PSD文件XAML UI選擇的TabItem如何刪除線。我正在完成它,但我不知道如何刪除選定tabItem中的行。在圖片上露面。WPF的TabControl時

這就是我需要的。 enter image description here

這就是我得到的。 enter image description here

如何刪除此行?它可能沒有硬編碼? 這裏是我的選項卡控件的代碼。

 <TabControl.Resources> 
      <Style TargetType="TabControl"> 
       <Setter Property="Template"> 
        <Setter.Value> 
         <ControlTemplate TargetType="{x:Type TabControl}"> 
          <Grid KeyboardNavigation.TabNavigation="Local"> 
           <Grid.RowDefinitions> 
            <RowDefinition Height="*"/> 
            <RowDefinition Height="Auto"/> 
           </Grid.RowDefinitions> 
           <Border 
            Name="Border" 
            Grid.Row="0" 
            BorderBrush="{StaticResource SolidBrush_Blue}" 
            BorderThickness="{TemplateBinding BorderThickness}" 
            KeyboardNavigation.TabNavigation="Local" 
            KeyboardNavigation.DirectionalNavigation="Contained" 
            KeyboardNavigation.TabIndex="2" > 
            <ContentPresenter 
             Name="PART_SelectedContentHost" 
             ContentSource="SelectedContent"> 
            </ContentPresenter> 
           </Border> 
           <TabPanel 
            Name="HeaderPanel" 
            Grid.Row="1" 
            Panel.ZIndex="1" 
            HorizontalAlignment="Center" 
            IsItemsHost="True" 
            KeyboardNavigation.TabIndex="1"/> 
          </Grid> 
         </ControlTemplate> 
        </Setter.Value> 
       </Setter> 
      </Style> 

      <!-- SimpleStyles: TabItem --> 
      <Style TargetType="{x:Type TabItem}"> 
       <Setter Property="Template"> 
        <Setter.Value> 
         <ControlTemplate TargetType="{x:Type TabItem}"> 
          <Grid 
           x:Name="grid"> 
           <Border 
            Name="Border" 
            Margin="5,0,5,0" 
            Padding="30 15 30 15" 
            CornerRadius="0 0 3 3" 
            BorderBrush="{StaticResource SolidBrush_Blue}" 
            BorderThickness="2 0 2 2" > 
            <ContentPresenter 
             x:Name="contentPresenter" 
             VerticalAlignment="Center" 
             ContentSource="Header" 
             TextBlock.Foreground="White" 
             TextBlock.FontFamily="{StaticResource FontFamilyRegular}" 
             RecognizesAccessKey="True"> 
            </ContentPresenter> 
           </Border> 
          </Grid> 
          <ControlTemplate.Triggers> 
           <Trigger Property="IsSelected" Value="True"> 
            <Setter TargetName="Border" 
              Property="Background" 
              Value="White" /> 
            <Setter TargetName="contentPresenter" 
              Property="TextBlock.FontFamily" 
              Value="{StaticResource FontFamilyBold}"/> 
            <Setter TargetName="contentPresenter" 
              Property="TextBlock.Foreground" 
              Value="{StaticResource SolidBrush_Blue}"/> 
           </Trigger> 
           <Trigger Property="IsSelected" Value="False"> 
            <Setter TargetName="Border" 
              Property="Background" 
              Value="{StaticResource SolidBrush_Blue}" /> 
            <Setter TargetName="contentPresenter" 
              Property="TextBlock.Background" 
              Value="White"/> 
            <Setter TargetName="contentPresenter" 
              Property="TextBlock.FontFamily" 
              Value="{StaticResource FontFamilyRegular}"/> 
            <Setter TargetName="contentPresenter" 
              Property="TextBlock.Foreground" 
              Value="White"/> 
           </Trigger> 
          </ControlTemplate.Triggers> 
         </ControlTemplate> 
        </Setter.Value> 
       </Setter> 
      </Style> 
     </TabControl.Resources> 

回答

3

在TabItem的模板邊境Border設置Margin="5,-1,5,0"。邊框將向上移動和隱藏的TabControl的邊緣與1

enter image description here

+0

呀默認厚度! Padding =「30 18 30 15」而不是「30 15 30 15」。完美的一個!非常感謝你。 –