modified tabcontrol style
This commit is contained in:
1 parent
41323afc74
commit
5b0f3d6e2f
4 files changed
+200
-176
No files matched your search
@@ -7,7 +7,7 @@
|
|||||||
<controls:ScrollViewer HorizontalScrollBarVisibility="Auto">
|
<controls:ScrollViewer HorizontalScrollBarVisibility="Auto">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Content="Default" Margin="32,32,0,0" HorizontalAlignment="Left"/>
|
<Label Style="{StaticResource LabelPrimary}" Content="Default" Margin="32,32,0,0" HorizontalAlignment="Left"/>
|
||||||
<controls:TabControl Margin="32,16,32,0" Width="800" Height="300">
|
<controls:TabControl Margin="32,16,32,0" Width="800" Height="300" IsScrollable="True">
|
||||||
<controls:TabItem Header="TabItem1">
|
<controls:TabItem Header="TabItem1">
|
||||||
<controls:SimplePanel Background="White"/>
|
<controls:SimplePanel Background="White"/>
|
||||||
</controls:TabItem>
|
</controls:TabItem>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="IsDraggable = True"/>
|
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="IsDraggable = True"/>
|
||||||
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="IsEnableAnimation = True"/>
|
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="IsEnableAnimation = True"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<controls:TabControl IsEnableAnimation="True" ShowCloseButton="True" IsDraggable="True" IsEnableTabFill="True" Margin="32,0,32,32" Width="800" Height="300">
|
<controls:TabControl IsScrollable="True" IsEnableAnimation="True" ShowCloseButton="True" IsDraggable="True" Margin="32,0,32,32" Width="800" Height="300">
|
||||||
<controls:TabItem Header="TabItem1">
|
<controls:TabItem Header="TabItem1">
|
||||||
<controls:SimplePanel Background="White"/>
|
<controls:SimplePanel Background="White"/>
|
||||||
</controls:TabItem>
|
</controls:TabItem>
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private bool _isRunning;
|
private bool _isRunning;
|
||||||
|
|
||||||
private Storyboard _scrollingAnimation = new Storyboard();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 滚动方向
|
/// 滚动方向
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -30,7 +28,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Orientation Orientation
|
public Orientation Orientation
|
||||||
{
|
{
|
||||||
get => (Orientation)GetValue(OrientationProperty);
|
get => (Orientation) GetValue(OrientationProperty);
|
||||||
set => SetValue(OrientationProperty, value);
|
set => SetValue(OrientationProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +43,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CanMouseWheel
|
public bool CanMouseWheel
|
||||||
{
|
{
|
||||||
get => (bool)GetValue(CanMouseWheelProperty);
|
get => (bool) GetValue(CanMouseWheelProperty);
|
||||||
set => SetValue(CanMouseWheelProperty, value);
|
set => SetValue(CanMouseWheelProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,10 +115,7 @@ namespace HandyControl.Controls
|
|||||||
};
|
};
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
|
|
||||||
_scrollingAnimation.Children.Add(animation);
|
BeginAnimation(CurrentVerticalOffsetProperty, animation, HandoffBehavior.Compose);
|
||||||
BeginStoryboard(_scrollingAnimation);
|
|
||||||
|
|
||||||
//BeginAnimation(CurrentVerticalOffsetProperty, animation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ScrollToHorizontalOffsetInternal(double offset, double milliseconds = 500)
|
internal void ScrollToHorizontalOffsetInternal(double offset, double milliseconds = 500)
|
||||||
@@ -165,7 +160,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsEnableInertia
|
public bool IsEnableInertia
|
||||||
{
|
{
|
||||||
get => (bool)GetValue(IsEnableInertiaProperty);
|
get => (bool) GetValue(IsEnableInertiaProperty);
|
||||||
set => SetValue(IsEnableInertiaProperty, value);
|
set => SetValue(IsEnableInertiaProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +175,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsPenetrating
|
public bool IsPenetrating
|
||||||
{
|
{
|
||||||
get => (bool)GetValue(IsPenetratingProperty);
|
get => (bool) GetValue(IsPenetratingProperty);
|
||||||
set => SetValue(IsPenetratingProperty, value);
|
set => SetValue(IsPenetratingProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +186,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
public static bool GetIsPenetrating(DependencyObject element)
|
public static bool GetIsPenetrating(DependencyObject element)
|
||||||
{
|
{
|
||||||
return (bool)element.GetValue(IsPenetratingProperty);
|
return (bool) element.GetValue(IsPenetratingProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -214,7 +209,7 @@ namespace HandyControl.Controls
|
|||||||
private double CurrentVerticalOffset
|
private double CurrentVerticalOffset
|
||||||
{
|
{
|
||||||
// ReSharper disable once UnusedMember.Local
|
// ReSharper disable once UnusedMember.Local
|
||||||
get => (double)GetValue(CurrentVerticalOffsetProperty);
|
get => (double) GetValue(CurrentVerticalOffsetProperty);
|
||||||
set => SetValue(CurrentVerticalOffsetProperty, value);
|
set => SetValue(CurrentVerticalOffsetProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +232,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double CurrentHorizontalOffset
|
public double CurrentHorizontalOffset
|
||||||
{
|
{
|
||||||
get => (double)GetValue(CurrentHorizontalOffsetProperty);
|
get => (double) GetValue(CurrentHorizontalOffsetProperty);
|
||||||
set => SetValue(CurrentHorizontalOffsetProperty, value);
|
set => SetValue(CurrentHorizontalOffsetProperty, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace HandyControl.Controls
|
|||||||
[TemplatePart(Name = OverflowButtonKey, Type = typeof(ContextMenuToggleButton))]
|
[TemplatePart(Name = OverflowButtonKey, Type = typeof(ContextMenuToggleButton))]
|
||||||
[TemplatePart(Name = HeaderPanelKey, Type = typeof(TabPanel))]
|
[TemplatePart(Name = HeaderPanelKey, Type = typeof(TabPanel))]
|
||||||
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
|
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
|
||||||
[TemplatePart(Name = OverflowButtonLeft, Type = typeof(Button))]
|
[TemplatePart(Name = ScrollButtonLeft, Type = typeof(Button))]
|
||||||
[TemplatePart(Name = OverflowButtonRight, Type = typeof(Button))]
|
[TemplatePart(Name = ScrollButtonRight, Type = typeof(Button))]
|
||||||
public class TabControl : System.Windows.Controls.TabControl
|
public class TabControl : System.Windows.Controls.TabControl
|
||||||
{
|
{
|
||||||
private const string OverflowButtonKey = "PART_OverflowButton";
|
private const string OverflowButtonKey = "PART_OverflowButton";
|
||||||
@@ -21,9 +21,9 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private const string OverflowScrollviewer = "PART_OverflowScrollviewer";
|
private const string OverflowScrollviewer = "PART_OverflowScrollviewer";
|
||||||
|
|
||||||
private const string OverflowButtonLeft = "PART_OverflowButtonLeft";
|
private const string ScrollButtonLeft = "PART_ScrollButtonLeft";
|
||||||
|
|
||||||
private const string OverflowButtonRight = "PART_OverflowButtonRight";
|
private const string ScrollButtonRight = "PART_ScrollButtonRight";
|
||||||
|
|
||||||
private ContextMenuToggleButton _buttonOverflow;
|
private ContextMenuToggleButton _buttonOverflow;
|
||||||
|
|
||||||
@@ -31,9 +31,9 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private ScrollViewer _scrollviewerOverflow;
|
private ScrollViewer _scrollviewerOverflow;
|
||||||
|
|
||||||
private Button _buttonOverflowLeft;
|
private Button _buttonScrollLeft;
|
||||||
|
|
||||||
private Button _buttonOverflowRight;
|
private Button _buttonScrollRight;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否为内部操作
|
/// 是否为内部操作
|
||||||
@@ -130,16 +130,21 @@ namespace HandyControl.Controls
|
|||||||
set => SetValue(TabItemHeightProperty, value);
|
set => SetValue(TabItemHeightProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Implement this
|
/// <summary>
|
||||||
|
/// 是否可以滚动
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsScrollableProperty = DependencyProperty.Register(
|
||||||
|
"IsScrollable", typeof(bool), typeof(TabControl), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否可以滚动
|
||||||
|
/// </summary>
|
||||||
public bool IsScrollable
|
public bool IsScrollable
|
||||||
{
|
{
|
||||||
get { return (bool)GetValue(IsScrollableProperty); }
|
get => (bool) GetValue(IsScrollableProperty);
|
||||||
set { SetValue(IsScrollableProperty, value); }
|
set => SetValue(IsScrollableProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty IsScrollableProperty =
|
|
||||||
DependencyProperty.Register("IsScrollable", typeof(bool), typeof(TabControl), new PropertyMetadata(ValueBoxes.FalseBox));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 可见的标签数量
|
/// 可见的标签数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -188,6 +193,20 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
public override void OnApplyTemplate()
|
public override void OnApplyTemplate()
|
||||||
{
|
{
|
||||||
|
if (_buttonOverflow != null)
|
||||||
|
{
|
||||||
|
if (_buttonOverflow.Menu != null)
|
||||||
|
{
|
||||||
|
_buttonOverflow.Menu.Closed -= Menu_Closed;
|
||||||
|
_buttonOverflow.Menu = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_buttonOverflow.Click -= ButtonOverflow_Click;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_buttonScrollLeft != null) _buttonScrollLeft.Click -= ButtonScrollLeft_Click;
|
||||||
|
if (_buttonScrollRight != null) _buttonScrollRight.Click -= ButtonScrollRight_Click;
|
||||||
|
|
||||||
base.OnApplyTemplate();
|
base.OnApplyTemplate();
|
||||||
_headerPanel = Template.FindName(HeaderPanelKey, this) as TabPanel;
|
_headerPanel = Template.FindName(HeaderPanelKey, this) as TabPanel;
|
||||||
|
|
||||||
@@ -195,31 +214,11 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
_buttonOverflow = Template.FindName(OverflowButtonKey, this) as ContextMenuToggleButton;
|
_buttonOverflow = Template.FindName(OverflowButtonKey, this) as ContextMenuToggleButton;
|
||||||
_scrollviewerOverflow = Template.FindName(OverflowScrollviewer, this) as ScrollViewer;
|
_scrollviewerOverflow = Template.FindName(OverflowScrollviewer, this) as ScrollViewer;
|
||||||
_buttonOverflowLeft = Template.FindName(OverflowButtonLeft, this) as Button;
|
_buttonScrollLeft = Template.FindName(ScrollButtonLeft, this) as Button;
|
||||||
_buttonOverflowRight = Template.FindName(OverflowButtonRight, this) as Button;
|
_buttonScrollRight = Template.FindName(ScrollButtonRight, this) as Button;
|
||||||
|
|
||||||
_buttonOverflowLeft.Click += (s, e) =>
|
if (_buttonScrollLeft != null) _buttonScrollLeft.Click += ButtonScrollLeft_Click;
|
||||||
{
|
if (_buttonScrollRight != null) _buttonScrollRight.Click += ButtonScrollRight_Click;
|
||||||
var currentOffset = _scrollviewerOverflow.CurrentHorizontalOffset;
|
|
||||||
var modulo = (currentOffset % TabItemWidth);
|
|
||||||
var offset = currentOffset - (modulo == 0 ? TabItemWidth : modulo);
|
|
||||||
|
|
||||||
if (offset >= 0)
|
|
||||||
{
|
|
||||||
_scrollviewerOverflow.ScrollToHorizontalOffsetInternal(offset);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_buttonOverflowRight.Click += (s, e) =>
|
|
||||||
{
|
|
||||||
var currentOffset = _scrollviewerOverflow.CurrentHorizontalOffset;
|
|
||||||
var offset = currentOffset + (TabItemWidth - (currentOffset % TabItemWidth));
|
|
||||||
|
|
||||||
if(offset <= _scrollviewerOverflow.ScrollableWidth)
|
|
||||||
{
|
|
||||||
_scrollviewerOverflow.ScrollToHorizontalOffsetInternal(offset);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_buttonOverflow != null)
|
if (_buttonOverflow != null)
|
||||||
{
|
{
|
||||||
@@ -231,48 +230,78 @@ namespace HandyControl.Controls
|
|||||||
Placement = PlacementMode.Bottom,
|
Placement = PlacementMode.Bottom,
|
||||||
PlacementTarget = _buttonOverflow
|
PlacementTarget = _buttonOverflow
|
||||||
};
|
};
|
||||||
menu.Closed += (s, e) => _buttonOverflow.IsChecked = false;
|
menu.Closed += Menu_Closed;
|
||||||
_buttonOverflow.Menu = menu;
|
_buttonOverflow.Menu = menu;
|
||||||
_buttonOverflow.Click += (s, e) =>
|
_buttonOverflow.Click += ButtonOverflow_Click;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Menu_Closed(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_buttonOverflow.IsChecked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonScrollRight_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var currentOffset = _scrollviewerOverflow.CurrentHorizontalOffset;
|
||||||
|
var offset = currentOffset + (TabItemWidth - currentOffset % TabItemWidth);
|
||||||
|
|
||||||
|
if (offset <= _scrollviewerOverflow.ScrollableWidth)
|
||||||
|
{
|
||||||
|
_scrollviewerOverflow.ScrollToHorizontalOffsetInternal(offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonScrollLeft_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var currentOffset = _scrollviewerOverflow.CurrentHorizontalOffset;
|
||||||
|
var modulo = currentOffset % TabItemWidth;
|
||||||
|
var offset = currentOffset - (modulo < 1e-6 ? TabItemWidth : modulo);
|
||||||
|
|
||||||
|
if (offset >= 0)
|
||||||
|
{
|
||||||
|
_scrollviewerOverflow.ScrollToHorizontalOffsetInternal(offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonOverflow_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_buttonOverflow.IsChecked == true)
|
||||||
|
{
|
||||||
|
_buttonOverflow.Menu.Items.Clear();
|
||||||
|
foreach (TabItem item in Items)
|
||||||
{
|
{
|
||||||
if (_buttonOverflow.IsChecked == true)
|
var menuItem = new MenuItem
|
||||||
{
|
{
|
||||||
_buttonOverflow.Menu.Items.Clear();
|
Header = item.Header,
|
||||||
foreach (TabItem item in Items)
|
Width = TabItemWidth,
|
||||||
|
IsChecked = item.IsSelected,
|
||||||
|
IsCheckable = true
|
||||||
|
};
|
||||||
|
menuItem.Click += delegate
|
||||||
|
{
|
||||||
|
_buttonOverflow.IsChecked = false;
|
||||||
|
var index = Items.IndexOf(item);
|
||||||
|
if (index >= _itemShowCount)
|
||||||
{
|
{
|
||||||
var menuItem = new MenuItem
|
Items.Remove(item);
|
||||||
|
Items.Insert(0, item);
|
||||||
|
if (IsEnableAnimation)
|
||||||
{
|
{
|
||||||
Header = item.Header,
|
_headerPanel.ClearValue(TabPanel.FluidMoveDurationProperty);
|
||||||
Width = TabItemWidth,
|
}
|
||||||
IsChecked = item.IsSelected,
|
else
|
||||||
IsCheckable = true
|
|
||||||
};
|
|
||||||
menuItem.Click += delegate
|
|
||||||
{
|
{
|
||||||
_buttonOverflow.IsChecked = false;
|
_headerPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
||||||
var index = Items.IndexOf(item);
|
}
|
||||||
if (index >= _itemShowCount)
|
_headerPanel.ForceUpdate = true;
|
||||||
{
|
_headerPanel.Measure(new Size(_headerPanel.DesiredSize.Width, ActualHeight));
|
||||||
Items.Remove(item);
|
_headerPanel.ForceUpdate = false;
|
||||||
Items.Insert(0, item);
|
|
||||||
if (IsEnableAnimation)
|
|
||||||
{
|
|
||||||
_headerPanel.ClearValue(TabPanel.FluidMoveDurationProperty);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_headerPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
|
||||||
}
|
|
||||||
_headerPanel.ForceUpdate = true;
|
|
||||||
_headerPanel.Measure(new Size(_headerPanel.DesiredSize.Width, ActualHeight));
|
|
||||||
_headerPanel.ForceUpdate = false;
|
|
||||||
}
|
|
||||||
item.IsSelected = true;
|
|
||||||
};
|
|
||||||
_buttonOverflow.Menu.Items.Add(menuItem);
|
|
||||||
}
|
}
|
||||||
}
|
item.IsSelected = true;
|
||||||
};
|
};
|
||||||
|
_buttonOverflow.Menu.Items.Add(menuItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,90 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="TabControlPlusTemplate" TargetType="controls:TabControl">
|
||||||
|
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||||
|
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition x:Name="ColumnDefinition0"/>
|
||||||
|
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
|
||||||
|
<RowDefinition x:Name="RowDefinition1" Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}">
|
||||||
|
<controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsEnableTabFill="{TemplateBinding IsEnableTabFill}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
|
||||||
|
<interactivity:Interaction.Behaviors>
|
||||||
|
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
||||||
|
<interactivity:FluidMoveBehavior.EaseX>
|
||||||
|
<CubicEase EasingMode="EaseOut"/>
|
||||||
|
</interactivity:FluidMoveBehavior.EaseX>
|
||||||
|
</interactivity:FluidMoveBehavior>
|
||||||
|
</interactivity:Interaction.Behaviors>
|
||||||
|
</controls:TabPanel>
|
||||||
|
</Border>
|
||||||
|
<Border x:Name="contentPanel" Background="{DynamicResource SecondaryRegionBrush}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||||
|
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||||
|
</Border>
|
||||||
|
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Right">
|
||||||
|
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="TabControlPlusScrollableTemplate" TargetType="controls:TabControl">
|
||||||
|
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||||
|
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition x:Name="ColumnDefinition0"/>
|
||||||
|
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
|
||||||
|
<RowDefinition x:Name="RowDefinition1" Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="0,0,1,1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Left" Panel.ZIndex="2">
|
||||||
|
<Border.CacheMode>
|
||||||
|
<BitmapCache SnapsToDevicePixels="True"/>
|
||||||
|
</Border.CacheMode>
|
||||||
|
<Button Style="{StaticResource ButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonLeft"/>
|
||||||
|
</Border>
|
||||||
|
<controls:ScrollViewer HorizontalScrollBarVisibility="Hidden" CanMouseWheel="True" Orientation="Horizontal" IsEnableInertia="True" Grid.Column="1" IsDeferredScrollingEnabled="True" x:Name="PART_OverflowScrollviewer">
|
||||||
|
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}" >
|
||||||
|
<controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsEnableTabFill="{TemplateBinding IsEnableTabFill}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
|
||||||
|
<interactivity:Interaction.Behaviors>
|
||||||
|
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
||||||
|
<interactivity:FluidMoveBehavior.EaseX>
|
||||||
|
<CubicEase EasingMode="EaseOut"/>
|
||||||
|
</interactivity:FluidMoveBehavior.EaseX>
|
||||||
|
</interactivity:FluidMoveBehavior>
|
||||||
|
</interactivity:Interaction.Behaviors>
|
||||||
|
</controls:TabPanel>
|
||||||
|
</Border>
|
||||||
|
</controls:ScrollViewer>
|
||||||
|
</Grid>
|
||||||
|
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Right">
|
||||||
|
<Border.CacheMode>
|
||||||
|
<BitmapCache SnapsToDevicePixels="True"/>
|
||||||
|
</Border.CacheMode>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Button Style="{StaticResource ButtonIcon}" BorderBrush="{DynamicResource BorderBrush}" Padding="8" BorderThickness="0,0,1,0" controls:IconElement.Geometry="{StaticResource RightGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonRight"/>
|
||||||
|
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
<Border x:Name="contentPanel" Background="{DynamicResource SecondaryRegionBrush}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||||
|
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
<Style TargetType="controls:TabControl">
|
<Style TargetType="controls:TabControl">
|
||||||
<Setter Property="Padding" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
||||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||||
@@ -78,96 +162,12 @@
|
|||||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
<Setter Property="BorderThickness" Value="1"/>
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template" Value="{StaticResource TabControlPlusTemplate}"/>
|
||||||
<Setter.Value>
|
<Style.Triggers>
|
||||||
<ControlTemplate TargetType="controls:TabControl">
|
<Trigger Property="IsScrollable" Value="True">
|
||||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
<Setter Property="Template" Value="{StaticResource TabControlPlusScrollableTemplate}"/>
|
||||||
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
</Trigger>
|
||||||
<Grid.ColumnDefinitions>
|
</Style.Triggers>
|
||||||
<ColumnDefinition x:Name="ColumnDefinition0"/>
|
|
||||||
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
|
|
||||||
<RowDefinition x:Name="RowDefinition1" Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0"
|
|
||||||
BorderThickness="0,0,1,0" BorderBrush="{DynamicResource BorderBrush}"
|
|
||||||
Background="{DynamicResource RegionBrush}" HorizontalAlignment="Left"
|
|
||||||
Panel.ZIndex="2">
|
|
||||||
<Border.CacheMode>
|
|
||||||
<BitmapCache SnapsToDevicePixels="True"/>
|
|
||||||
</Border.CacheMode>
|
|
||||||
<Border.Effect>
|
|
||||||
<DropShadowEffect Direction="-45" BlurRadius="25"
|
|
||||||
ShadowDepth="8" Opacity="0.5"
|
|
||||||
Color="{DynamicResource EffectShadowColor}"/>
|
|
||||||
</Border.Effect>
|
|
||||||
|
|
||||||
<Button Style="{DynamicResource ButtonIcon}"
|
|
||||||
controls:IconElement.Geometry="{StaticResource LeftGeometry}"
|
|
||||||
Grid.Column="0"
|
|
||||||
Foreground="{DynamicResource PrimaryTextBrush}"
|
|
||||||
x:Name="PART_OverflowButtonLeft"
|
|
||||||
/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<controls:ScrollViewer HorizontalScrollBarVisibility="Hidden"
|
|
||||||
CanMouseWheel="True" Orientation="Horizontal"
|
|
||||||
IsEnableInertia="True"
|
|
||||||
Grid.Column="1"
|
|
||||||
IsDeferredScrollingEnabled="True"
|
|
||||||
x:Name="PART_OverflowScrollviewer">
|
|
||||||
|
|
||||||
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}" >
|
|
||||||
<controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsEnableTabFill="{TemplateBinding IsEnableTabFill}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
|
|
||||||
<interactivity:Interaction.Behaviors>
|
|
||||||
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
|
||||||
<interactivity:FluidMoveBehavior.EaseX>
|
|
||||||
<CubicEase EasingMode="EaseOut"/>
|
|
||||||
</interactivity:FluidMoveBehavior.EaseX>
|
|
||||||
</interactivity:FluidMoveBehavior>
|
|
||||||
</interactivity:Interaction.Behaviors>
|
|
||||||
</controls:TabPanel>
|
|
||||||
</Border>
|
|
||||||
</controls:ScrollViewer>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}"
|
|
||||||
Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BorderBrush}"
|
|
||||||
Background="{DynamicResource RegionBrush}" HorizontalAlignment="Right">
|
|
||||||
<Border.Effect>
|
|
||||||
<DropShadowEffect Direction="-135" BlurRadius="25"
|
|
||||||
ShadowDepth="8" Opacity="0.5"
|
|
||||||
Color="{DynamicResource EffectShadowColor}"/>
|
|
||||||
</Border.Effect>
|
|
||||||
<Border.CacheMode>
|
|
||||||
<BitmapCache SnapsToDevicePixels="True"/>
|
|
||||||
</Border.CacheMode>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<Button Style="{DynamicResource ButtonIcon}"
|
|
||||||
controls:IconElement.Geometry="{StaticResource RightGeometry}"
|
|
||||||
Foreground="{DynamicResource PrimaryTextBrush}"
|
|
||||||
x:Name="PART_OverflowButtonRight"/>
|
|
||||||
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
<Border x:Name="contentPanel" Background="{DynamicResource SecondaryRegionBrush}"
|
|
||||||
Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local"
|
|
||||||
>
|
|
||||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style BasedOn="{StaticResource TabControlBaseStyle}" TargetType="TabControl"/>
|
<Style BasedOn="{StaticResource TabControlBaseStyle}" TargetType="TabControl"/>
|
||||||
|
|||||||
Reference in new issue
Block a user