我是WPF中的新成員。在這裏,我發佈了一張TabControl
的照片。只是引導我如何重新設計WPF中具有相同用戶界面的選項卡。如何重新設置WPF中的TabControl
回答
在這種情況下,你將需要實現一個Style
/Template
爲TabControl
得到這個形式。 TabControl
有三個方向標籤:中央(default
),左右方向。你需要離開方向,以圖片來判斷。
風格爲TabItem
(元素TabControl
)將是一個在所有方向。
樣式爲TabControl
與左方向:
<Style x:Key="LeftTabControl" TargetType="{x:Type TabControl}">
<Setter Property="TabStripPlacement" Value="Left" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Background" Value="White" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid ClipToBounds="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
<Grid.ColumnDefinitions>
<ColumnDefinition Name="ColumnDefinition0" />
<ColumnDefinition Width="0" Name="ColumnDefinition1" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" Name="RowDefinition0" />
<RowDefinition Height="*" Name="RowDefinition1" />
</Grid.RowDefinitions>
<Border x:Name="HeaderBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0" Background="#FAFAFA" Margin="0">
<TabPanel IsItemsHost="True" Name="HeaderPanel" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1" Grid.Column="0" Grid.Row="0" />
</Border>
<Grid Name="ContentPanel" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Column="0" Grid.Row="1">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0">
<ContentPresenter Content="{TemplateBinding SelectedContent}" ContentTemplate="{TemplateBinding SelectedContentTemplate}" ContentStringFormat="{TemplateBinding SelectedContentStringFormat}" ContentSource="SelectedContent" Name="PART_SelectedContentHost" Margin="2" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</Border>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="TabControl.TabStripPlacement" Value="Left">
<Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="HeaderPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="ColumnDefinition0" Property="ColumnDefinition.Width" Value="Auto" />
<Setter TargetName="ColumnDefinition1" Property="ColumnDefinition.Width" Value="*" />
<Setter TargetName="RowDefinition0" Property="RowDefinition.Height" Value="*" />
<Setter TargetName="RowDefinition1" Property="RowDefinition.Height" Value="0" />
<Setter TargetName="HeaderBorder" Property="FrameworkElement.Margin" Value="0,0,0,0" />
</Trigger>
<Trigger Property="UIElement.IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
樣式TabItem
:
<Style x:Key="{x:Type TabItem}" TargetType="{x:Type TabItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Gray" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="MinHeight" Value="20" />
<Setter Property="FontFamily" Value="./#Segoe UI" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="AllowDrop" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border SnapsToDevicePixels="True" Name="Border" Margin="0,0,2,0" Padding="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0">
<ContentPresenter Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,5,5,5" VerticalAlignment="Center" RecognizesAccessKey="True" ContentSource="Header" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TabStripPlacement" Value="Bottom">
<Setter TargetName="Border" Property="CornerRadius" Value="0,0,0,0" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#F5B79C" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsSelected" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="#DB805A" />
<Setter Property="Foreground" Value="White" />
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="Black" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
MainWindow
<TabControl Style="{StaticResource LeftTabControl}" Background="Gainsboro" Width="300" HorizontalAlignment="Left">
<TabItem Header="New">
<Label Content="TestNew" />
</TabItem>
<TabItem Header="Old">
<Label Content="TestOld" />
</TabItem>
<TabItem Header="Recent">
<Label Content="RecentHelp" />
</TabItem>
</TabControl>
Output
要添加一個三角形的選擇,你需要修復的模板TabItem
。添加Path
與三角形並顯示在當前TabItem
:
<ControlTemplate TargetType="{x:Type TabItem}">
<Border SnapsToDevicePixels="True" Name="Border" Margin="0,0,2,0" Padding="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0">
<Grid>
<Path x:Name="CurrentTriangle" Width="10" Height="14" Stretch="Fill" Margin="0,0,-3,0" Fill="#FAFAFA" HorizontalAlignment="Right" Data="F1 M 287.328,237.333L 319.344,255.818L 319.344,218.849L 287.328,237.333 Z " Visibility="Collapsed" />
<ContentPresenter Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,5,5,5" VerticalAlignment="Center" RecognizesAccessKey="True" ContentSource="Header" />
</Grid>
</Border>
<ControlTemplate.Triggers>
...
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="CurrentTriangle" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
輸出與三角:
的TabItem
風格
全面上市與Triangle
:
<Style x:Key="{x:Type TabItem}" TargetType="{x:Type TabItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Gray" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="MinHeight" Value="20" />
<Setter Property="FontFamily" Value="./#Segoe UI" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="AllowDrop" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border SnapsToDevicePixels="True" Name="Border" Margin="0,0,2,0" Padding="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0">
<Grid>
<Path x:Name="CurrentTriangle" Width="10" Height="14" Stretch="Fill" Margin="0,0,-3,0" Fill="#FAFAFA" HorizontalAlignment="Right" Data="F1 M 287.328,237.333L 319.344,255.818L 319.344,218.849L 287.328,237.333 Z " Visibility="Collapsed" />
<ContentPresenter Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,5,5,5" VerticalAlignment="Center" RecognizesAccessKey="True" ContentSource="Header" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TabStripPlacement" Value="Bottom">
<Setter TargetName="Border" Property="CornerRadius" Value="0,0,0,0" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="CurrentTriangle" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#F5B79C" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsSelected" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="Background" Value="#DB805A" />
<Setter Property="Foreground" Value="White" />
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="Black" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
Edit:
我我會按順序告訴你。
所有Styles
的,我所上面給出置於App.xaml
像(最好是他們在那裏):
<Application x:Class="SomeProgram.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style x:Key="LeftTabControl" TargetType="{x:Type TabControl}">
...
</Style>
<Style x:Key="{x:Type TabItem}" TargetType="{x:Type TabItem}">
...
</Style>
</Application.Resources>
指定
Triangle
圖像路徑。
默認情況下,TabItem
模板看起來是這樣的:
<Setter Property="Template">
<Setter.Value>
<Border SnapsToDevicePixels="True" Name="Border" Margin="0,0,2,0" Padding="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0">
<ContentPresenter Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,5,5,5" VerticalAlignment="Center" RecognizesAccessKey="True" ContentSource="Header" />
</Border>
的負責顯示的內容,在這種情況下,用於顯示在標題的文本ContentPresenter
。但是,我們需要有一個顯示三角形,所以把他加爲圖Path
:
<Path x:Name="CurrentTriangle" Width="10" Height="14" Stretch="Fill" Margin="0,0,-3,0" Fill="#FAFAFA" HorizontalAlignment="Right" Data="F1 M 287.328,237.333L 319.344,255.818L 319.344,218.849L 287.328,237.333 Z " Visibility="Collapsed" />
這不是Image
,則Path
更容易使用,無需保留資源。更多信息,你可以找到here。
所以,現在我們有一個三角形出現,但我們需要顯示它時,選項卡將被選中。關於觸發你可以找到here
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="CurrentTriangle" Property="Visibility" Value="Visible" />
</Trigger>
的更多信息:爲此,我們使用觸發器來做到這一點。
所選梯度背色
TabItem
。
顏色選擇TabItem
也設置在TabItem
風格觸發:
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#F5B79C" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
這裏設置的Background
和選擇TabItem
的Foreground
值。漸變色定義這樣的:
<LinearGradientBrush>
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
您需要設置漸變色爲觸發屬性Background
。
背景的TabControl的
Background
設置爲TabControl's
風格的這條線:約畫筆
<Style x:Key="LeftTabControl" TargetType="{x:Type TabControl}">
...
<Setter Property="Background" Value="White" />
的更多信息(漸變的)here。
有關款式/模板的信息here。
試試這個。 在您的窗口中添加一個選項卡控件,然後將TabStripPlacement設置爲Left。然後將一些選項卡項添加到此選項卡控件。現在在Windows.Resource部分添加Style。
<Style TargetType="{x:Type TabItem}">
<Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Padding" Value="6,1,6,1"/>
<Setter Property="BorderBrush" Value="{StaticResource TabControlNormalBorderBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="MinHeight" Value="30"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid SnapsToDevicePixels="true">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected"/>
<VisualState x:Name="Selected"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Bd" BorderThickness="1,1,1,0" Padding="{TemplateBinding Padding}">
<Border.Background>
<RadialGradientBrush GradientOrigin="0.019,0.518" RadiusY="0.741" RadiusX="0.578" Center="0.019,0.518">
<GradientStop Color="#FFC5C7C8" Offset="0.47"/>
<GradientStop Color="#FFD1D3D8"/>
<GradientStop Color="#FFE2E2E2" Offset="1"/>
</RadialGradientBrush>
</Border.Background>
<Grid x:Name="grd" VerticalAlignment="Stretch" MinWidth="100" MinHeight="40">
<Path x:Name="CurrentTriangle" Width="10" Height="14" Stretch="Fill" Margin="0,0,-3,0" Fill="#FAFAFA" HorizontalAlignment="Right" Data="F1 M 287.328,237.333L 319.344,255.818L 319.344,218.849L 287.328,237.333 Z " Visibility="Collapsed" />
<ContentPresenter x:Name="Content" ContentSource="Header" HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource TabItemHotBackground}"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Panel.ZIndex" Value="1"/>
<Setter Property="Visibility" Value="Visible" TargetName="CurrentTriangle"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<RadialGradientBrush GradientOrigin="0.501,0.914" RadiusY="0.419" RadiusX="0.355" Center="0.501,0.914">
<GradientStop Color="#FF082876" Offset="0.727"/>
<GradientStop Color="#FF1145C4" Offset="0.221"/>
<GradientStop Color="#FF0E245C" Offset="1"/>
</RadialGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="false"/>
<Condition Property="IsMouseOver" Value="true"/>
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" TargetName="Bd" Value="Silver"/>
</MultiTrigger>
<Trigger Property="TabStripPlacement" Value="Left">
<Setter Property="BorderThickness" TargetName="Bd" Value="0"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="TabStripPlacement" Value="Left"/>
</MultiTrigger.Conditions>
<Setter Property="Margin" Value="0"/>
<Setter Property="Margin" TargetName="Content" Value="0,0,1,0"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource TabItemDisabledBackground}"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource TabItemDisabledBorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
對於自定義選項卡標題,您可以使用標題模板。自定義模板將會很好。案件 。有些東西就像
<TabControl TabStripPlacement="Left">
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="005_Task_24x24_72.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="008_Reminder_24x24.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="023_Tip_16x16_72.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="1409_Monitor_24x24.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="FavoriteStar_FrontFacing_24x24_72.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="Music_Note_Double_24.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="005_Task_24x24_72.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="005_Task_24x24_72.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="005_Task_24x24_72.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem >
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Image Height="16" Width="16" Source="005_Task_24x24_72.png"/>
<TextBlock Text="Sample Tab"/>
</StackPanel>
</TabItem.Header>
<Grid Background="#FFE5E5E5"/>
</TabItem>
</TabControl>
u能幫助我生成兩個梯度。一個是活動標籤項目的藍色漸變,另一個是混合白色漸變的標籤背景。在這裏我試圖生成一個漸變,但它看起來不像上面那個。這裏是代碼。 <放射漸變畫筆X:鍵= 「徑向」 \t \t中心= 「0.52,0.48」 漸變原點= 「0.5,0.5」 半徑= 「0.5」 半徑= 「0.5」 \t \t的spreadMethod = 「墊」 ColorInterpolationMode = 「ScRgbLinearInterpolation」> \t \t <漸變停止顏色= 「#FF183EEF」 偏移= 「0」/> \t \t <漸變停止顏色= 「#FF000000」 偏移= 「1」/> 放射漸變畫筆> – Thomas
脫除X:鍵,然後重 – JSJ
- 1. WPF TabControl的重新排序選項卡
- 2. WPF SelectedIndex設置問題的TabControl
- 3. 每次WPF TabControl重新綁定
- 4. 如何在TabControl中設置新的TabPage頁面的屬性?
- 5. 設置的DataContext中的TabControl
- 6. WPF C中的Tabcontrol#
- 7. 如何更改WPF中的tabcontrol中的標籤項位置
- 8. 如何設置標籤位置尊重tabcontrol大小?
- 9. 如何在WPF頁面重新載入中設置焦點?
- 10. 將事件重新連接到WPF TabControl中的選定TabItem
- 11. 如何更改WPF TabControl中TabItems的重疊順序
- 12. 如何使用新的TabPages保存設置TabControl? Visual Studio和C#
- 13. WPF的TabControl時
- 14. 如何輕鬆地重新排序TabControl?
- 15. WPF/C#:如何在TabControl中引用TabItems?
- 16. 如何在設計時重新排列WinForms TabControl TabPages?
- 17. WPF中的TabControl的SelectionChangedEventHandler
- 18. WPF的TabControl的SelectedItem重置窗口已經關閉
- 19. WPF MVVM中的動態TabControl
- 20. 如何在WindowsFormsHost WPF控件中配置WinForms TabControl?
- 21. 的TabControl和設置焦點上的文本框在WPF
- 22. 帶有'新標籤'按鈕的WPF TabControl?
- 23. WPF與ContentControl的TabControl
- 24. WPF定製的TabControl
- 25. 設置WPF TabControl非活動選項卡的背景顏色
- 26. WTF WPF TabControl?
- 27. tabcontrol width wpf
- 28. wpf TabControl綁定
- 29. WPF TabControl與Pages
- 30. WPF - TabControl問題
感謝您的幫助。我在wpf方面很弱。所以想問問你在哪裏指定三角形的圖片路徑。需要添加哪種類型的代碼才能爲選定的選項卡項目提供這種漸變背景顏色。我需要添加什麼類型的代碼才能爲製表符背景添加漸變顏色,如灰色和白色的混合。 – Thomas
@Thomas:請參閱我的編輯。 –
可以幫助我生成兩個漸變。一個是活動標籤項目的藍色漸變,另一個是混合白色漸變的標籤背景。在這裏我試圖生成一個漸變,但它看起來不像上面那個。這裏是代碼。 <放射漸變畫筆X:鍵= 「徑向」 \t \t中心= 「0.52,0.48」 漸變原點= 「0.5,0.5」 半徑= 「0.5」 半徑= 「0.5」 \t \t的spreadMethod = 「墊」 ColorInterpolationMode = 「ScRgbLinearInterpolation」> \t \t <漸變停止顏色= 「#FF183EEF」 偏移= 「0」/> \t \t <漸變停止顏色= 「#FF000000」 偏移= 「1」/> 放射漸變畫筆> – Thomas