fixed a bug of tabcontrol
This commit is contained in:
1 parent
d4df9129c2
commit
445bef02ce
2 files changed
+10
-1
No files matched your search
@@ -15,6 +15,7 @@ namespace HandyControl.Controls
|
|||||||
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
|
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
|
||||||
[TemplatePart(Name = ScrollButtonLeft, Type = typeof(Button))]
|
[TemplatePart(Name = ScrollButtonLeft, Type = typeof(Button))]
|
||||||
[TemplatePart(Name = ScrollButtonRight, Type = typeof(Button))]
|
[TemplatePart(Name = ScrollButtonRight, Type = typeof(Button))]
|
||||||
|
[TemplatePart(Name = HeaderBorder, Type = typeof(Border))]
|
||||||
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";
|
||||||
@@ -27,6 +28,8 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private const string ScrollButtonRight = "PART_ScrollButtonRight";
|
private const string ScrollButtonRight = "PART_ScrollButtonRight";
|
||||||
|
|
||||||
|
private const string HeaderBorder = "PART_HeaderBorder";
|
||||||
|
|
||||||
private ContextMenuToggleButton _buttonOverflow;
|
private ContextMenuToggleButton _buttonOverflow;
|
||||||
|
|
||||||
private TabPanel _headerPanel;
|
private TabPanel _headerPanel;
|
||||||
@@ -37,6 +40,8 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private Button _buttonScrollRight;
|
private Button _buttonScrollRight;
|
||||||
|
|
||||||
|
private Border _headerBorder;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否为内部操作
|
/// 是否为内部操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -220,6 +225,9 @@ namespace HandyControl.Controls
|
|||||||
item.TabPanel = _headerPanel;
|
item.TabPanel = _headerPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_headerBorder?.InvalidateMeasure();
|
||||||
|
|
||||||
IsInternalAction = false;
|
IsInternalAction = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +256,7 @@ namespace HandyControl.Controls
|
|||||||
_scrollViewerOverflow = GetTemplateChild(OverflowScrollviewer) as ScrollViewer;
|
_scrollViewerOverflow = GetTemplateChild(OverflowScrollviewer) as ScrollViewer;
|
||||||
_buttonScrollLeft = GetTemplateChild(ScrollButtonLeft) as Button;
|
_buttonScrollLeft = GetTemplateChild(ScrollButtonLeft) as Button;
|
||||||
_buttonScrollRight = GetTemplateChild(ScrollButtonRight) as Button;
|
_buttonScrollRight = GetTemplateChild(ScrollButtonRight) as Button;
|
||||||
|
_headerBorder = GetTemplateChild(HeaderBorder) as Border;
|
||||||
|
|
||||||
if (_buttonScrollLeft != null) _buttonScrollLeft.Click += ButtonScrollLeft_Click;
|
if (_buttonScrollLeft != null) _buttonScrollLeft.Click += ButtonScrollLeft_Click;
|
||||||
if (_buttonScrollRight != null) _buttonScrollRight.Click += ButtonScrollRight_Click;
|
if (_buttonScrollRight != null) _buttonScrollRight.Click += ButtonScrollRight_Click;
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
<Button Focusable="False" Style="{StaticResource ButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonLeft"/>
|
<Button Focusable="False" Style="{StaticResource ButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonLeft"/>
|
||||||
</Border>
|
</Border>
|
||||||
<controls:ScrollViewer HorizontalScrollBarVisibility="Hidden" CanMouseWheel="True" Orientation="Horizontal" IsEnableInertia="True" Grid.Row="0" Grid.Column="1" IsDeferredScrollingEnabled="True" x:Name="PART_OverflowScrollviewer">
|
<controls:ScrollViewer HorizontalScrollBarVisibility="Hidden" CanMouseWheel="True" Orientation="Horizontal" IsEnableInertia="True" Grid.Row="0" Grid.Column="1" IsDeferredScrollingEnabled="True" x:Name="PART_OverflowScrollviewer">
|
||||||
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}" >
|
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}" Name="PART_HeaderBorder">
|
||||||
<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">
|
<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:Interaction.Behaviors>
|
||||||
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
||||||
|
|||||||
Reference in new issue
Block a user