This commit is contained in:
NaBian committed 2020-01-05 23:34:39 +08:00
1 parent 515b4b1ab6
commit 1285286e0e
19 files changed
+58 -58

No files matched your search

@@ -103,7 +103,7 @@
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"/> <Setter Property="controls:ScrollViewer.IsInertiaEnabled" Value="False"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/> <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
@@ -111,7 +111,7 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TreeView"> <ControlTemplate TargetType="TreeView">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<controls:ScrollViewer x:Name="_tv_scrollviewer_" IsEnableInertia="{Binding Path=(controls:ScrollViewer.IsEnableInertia),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> <controls:ScrollViewer x:Name="_tv_scrollviewer_" IsInertiaEnabled="{Binding Path=(controls:ScrollViewer.IsInertiaEnabled),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter/> <ItemsPresenter/>
</controls:ScrollViewer> </controls:ScrollViewer>
</Border> </Border>
@@ -103,14 +103,14 @@
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"/> <Setter Property="controls:ScrollViewer.IsInertiaEnabled" Value="False"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TreeView"> <ControlTemplate TargetType="TreeView">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<controls:ScrollViewer x:Name="_tv_scrollviewer_" IsEnableInertia="{Binding Path=(controls:ScrollViewer.IsEnableInertia),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> <controls:ScrollViewer x:Name="_tv_scrollviewer_" IsInertiaEnabled="{Binding Path=(controls:ScrollViewer.IsInertiaEnabled),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter/> <ItemsPresenter/>
</controls:ScrollViewer> </controls:ScrollViewer>
</Border> </Border>
@@ -103,7 +103,7 @@
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"/> <Setter Property="controls:ScrollViewer.IsInertiaEnabled" Value="False"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/> <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
@@ -111,7 +111,7 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TreeView"> <ControlTemplate TargetType="TreeView">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<controls:ScrollViewer x:Name="_tv_scrollviewer_" IsEnableInertia="{Binding Path=(controls:ScrollViewer.IsEnableInertia),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> <controls:ScrollViewer x:Name="_tv_scrollviewer_" IsInertiaEnabled="{Binding Path=(controls:ScrollViewer.IsInertiaEnabled),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter/> <ItemsPresenter/>
</controls:ScrollViewer> </controls:ScrollViewer>
</Border> </Border>
@@ -35,7 +35,7 @@
<userControl:LeftMainContent/> <userControl:LeftMainContent/>
<userControl:MainContent Grid.Column="1"/> <userControl:MainContent Grid.Column="1"/>
<GridSplitter Grid.Column="1" HorizontalAlignment="Left" Width="4" Background="Transparent" BorderThickness="1,0,0,0" BorderBrush="{DynamicResource BorderBrush}"/> <GridSplitter Grid.Column="1" HorizontalAlignment="Left" Width="4" Background="Transparent" BorderThickness="1,0,0,0" BorderBrush="{DynamicResource BorderBrush}"/>
<hc:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsEnableInertia="True" IsPenetrating="True"> <hc:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsInertiaEnabled="True" IsPenetrating="True">
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/> <StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
</hc:ScrollViewer> </hc:ScrollViewer>
</Grid> </Grid>
@@ -5,7 +5,7 @@
Background="{DynamicResource RegionBrush}"> Background="{DynamicResource RegionBrush}">
<hc:TransitioningContentControl> <hc:TransitioningContentControl>
<hc:SimplePanel Width="500" Height="400"> <hc:SimplePanel Width="500" Height="400">
<hc:ScrollViewer Name="ScrollViewerDemo" IsEnableInertia="True" Margin="0,10,0,0"> <hc:ScrollViewer Name="ScrollViewerDemo" IsInertiaEnabled="True" Margin="0,10,0,0">
<Border Height="2000" Margin="8,0"> <Border Height="2000" Margin="8,0">
<Border.Background> <Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
@@ -13,7 +13,7 @@
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}"> <Border BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
<hc:ScrollViewer Orientation="Horizontal" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden" IsEnableInertia="True"> <hc:ScrollViewer Orientation="Horizontal" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden" IsInertiaEnabled="True">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Border Style="{StaticResource BorderRegion}" Width="200" Height="200" Margin="10,10,32,10"> <Border Style="{StaticResource BorderRegion}" Width="200" Height="200" Margin="10,10,32,10">
<Border Background="{DynamicResource PrimaryBrush}"> <Border Background="{DynamicResource PrimaryBrush}">
@@ -44,7 +44,7 @@
</hc:ScrollViewer> </hc:ScrollViewer>
</Border> </Border>
<Border Grid.Row="1" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Margin="0,16,0,0"> <Border Grid.Row="1" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Margin="0,16,0,0">
<hc:ScrollViewer IsEnableInertia="True"> <hc:ScrollViewer IsInertiaEnabled="True">
<WrapPanel Orientation="Horizontal"> <WrapPanel Orientation="Horizontal">
<Border Style="{StaticResource BorderRegion}" Width="200" Height="200" Margin="10,10,32,10"> <Border Style="{StaticResource BorderRegion}" Width="200" Height="200" Margin="10,10,32,10">
<Border Background="{DynamicResource PrimaryBrush}"> <Border Background="{DynamicResource PrimaryBrush}">
@@ -40,12 +40,12 @@
</hc:TabItem> </hc:TabItem>
</hc:TabControl> </hc:TabControl>
<StackPanel Orientation="Horizontal" Margin="32,32,32,16"> <StackPanel Orientation="Horizontal" Margin="32,32,32,16">
<Label Style="{StaticResource LabelPrimary}" Margin="0" Content="IsEnableTabFill = True"/> <Label Style="{StaticResource LabelPrimary}" Margin="0" Content="IsTabFillEnabled = True"/>
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="ShowCloseButton = True"/> <Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="ShowCloseButton = True"/>
<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="IsAnimationEnabled = True"/>
</StackPanel> </StackPanel>
<hc:TabControl x:Name="TabControlDemo" IsEnableAnimation="True" ShowCloseButton="True" IsDraggable="True" IsEnableTabFill="True" Margin="32,0,32,32" Width="800" Height="300"> <hc:TabControl x:Name="TabControlDemo" IsAnimationEnabled="True" ShowCloseButton="True" IsDraggable="True" IsTabFillEnabled="True" Margin="32,0,32,32" Width="800" Height="300">
<hc:TabItem Header="TabItem1" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource ConfigGeometry}"> <hc:TabItem Header="TabItem1" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource ConfigGeometry}">
<hc:SimplePanel Background="{DynamicResource RegionBrush}"/> <hc:SimplePanel Background="{DynamicResource RegionBrush}"/>
</hc:TabItem> </hc:TabItem>
@@ -68,7 +68,7 @@
<hc:SimplePanel Background="#FFE8E03F"/> <hc:SimplePanel Background="#FFE8E03F"/>
</hc:TabItem> </hc:TabItem>
</hc:TabControl> </hc:TabControl>
<hc:TabControl IsEnableAnimation="True" ShowCloseButton="True" IsDraggable="True" ItemsSource="{Binding DataList}" Width="800" Height="300"> <hc:TabControl IsAnimationEnabled="True" ShowCloseButton="True" IsDraggable="True" ItemsSource="{Binding DataList}" Width="800" Height="300">
<TabControl.ItemTemplate> <TabControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding Header}"/> <TextBlock Text="{Binding Header}"/>
@@ -1,4 +1,4 @@
<Border hc:ScrollViewer.IsEnableInertia="True" <Border hc:ScrollViewer.IsInertiaEnabled="True"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:command="http://www.galasoft.ch/mvvmlight" xmlns:command="http://www.galasoft.ch/mvvmlight"
x:Class="HandyControlDemo.UserControl.LeftMainContent" x:Class="HandyControlDemo.UserControl.LeftMainContent"
@@ -5,7 +5,7 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs" xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Background="{DynamicResource RegionBrush}"> Background="{DynamicResource RegionBrush}">
<hc:TransitioningContentControl> <hc:TransitioningContentControl>
<hc:ScrollViewer IsEnableInertia="True"> <hc:ScrollViewer IsInertiaEnabled="True">
<StackPanel Margin="32"> <StackPanel Margin="32">
<WrapPanel ItemWidth="160" ItemHeight="130"> <WrapPanel ItemWidth="160" ItemHeight="130">
<StackPanel> <StackPanel>
@@ -5,7 +5,7 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs" xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Background="{DynamicResource RegionBrush}"> Background="{DynamicResource RegionBrush}">
<hc:TransitioningContentControl> <hc:TransitioningContentControl>
<hc:ScrollViewer IsEnableInertia="True"> <hc:ScrollViewer IsInertiaEnabled="True">
<StackPanel Margin="32"> <StackPanel Margin="32">
<WrapPanel ItemWidth="160" ItemHeight="130"> <WrapPanel ItemWidth="160" ItemHeight="130">
<StackPanel> <StackPanel>
@@ -5,7 +5,7 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs" xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:hc="https://handyorg.github.io/handycontrol"> xmlns:hc="https://handyorg.github.io/handycontrol">
<hc:TransitioningContentControl> <hc:TransitioningContentControl>
<hc:ScrollViewer IsEnableInertia="True"> <hc:ScrollViewer IsInertiaEnabled="True">
<StackPanel Margin="32"> <StackPanel Margin="32">
<WrapPanel ItemWidth="160" ItemHeight="130"> <WrapPanel ItemWidth="160" ItemHeight="130">
<StackPanel> <StackPanel>
@@ -19,7 +19,7 @@
<Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/> <Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/>
<Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/> <Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
</WrapPanel> </WrapPanel>
<hc:ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsEnableInertia="True" IsPenetrating="True"> <hc:ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsInertiaEnabled="True" IsPenetrating="True">
<StackPanel hc:Growl.Token="{x:Static data:MessageToken.GrowlDemoPanel}" VerticalAlignment="Top" Margin="0,10,10,10"/> <StackPanel hc:Growl.Token="{x:Static data:MessageToken.GrowlDemoPanel}" VerticalAlignment="Top" Margin="0,10,10,10"/>
</hc:ScrollViewer> </hc:ScrollViewer>
</hc:SimplePanel> </hc:SimplePanel>
@@ -21,7 +21,7 @@ namespace HandyControl.Controls
Content = new ScrollViewer Content = new ScrollViewer
{ {
VerticalScrollBarVisibility = ScrollBarVisibility.Hidden, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
IsEnableInertia = true, IsInertiaEnabled = true,
Content = GrowlPanel Content = GrowlPanel
}; };
} }
@@ -35,7 +35,7 @@ namespace HandyControl.Controls
{ {
_scrollViewer.ScrollChanged += ScrollViewer_ScrollChanged; _scrollViewer.ScrollChanged += ScrollViewer_ScrollChanged;
if (_scrollViewer is ScrollViewer scrollViewerHandy && Animated && scrollViewerHandy.IsEnableInertia) if (_scrollViewer is ScrollViewer scrollViewerHandy && Animated && scrollViewerHandy.IsInertiaEnabled)
{ {
_gotoTopAction = () => scrollViewerHandy.ScrollToTopInternal(AnimationTime); _gotoTopAction = () => scrollViewerHandy.ScrollToTopInternal(AnimationTime);
} }
@@ -51,7 +51,7 @@ namespace HandyControl.Controls
{ {
if (!CanMouseWheel) return; if (!CanMouseWheel) return;
if (!IsEnableInertia) if (!IsInertiaEnabled)
{ {
if (Orientation == Orientation.Vertical) if (Orientation == Orientation.Vertical)
{ {
@@ -142,26 +142,26 @@ namespace HandyControl.Controls
/// <summary> /// <summary>
/// 是否支持惯性 /// 是否支持惯性
/// </summary> /// </summary>
public static readonly DependencyProperty IsEnableInertiaProperty = DependencyProperty.RegisterAttached( public static readonly DependencyProperty IsInertiaEnabledProperty = DependencyProperty.RegisterAttached(
"IsEnableInertia", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(ValueBoxes.FalseBox)); "IsInertiaEnabled", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(ValueBoxes.FalseBox));
public static void SetIsEnableInertia(DependencyObject element, bool value) public static void SetIsInertiaEnabled(DependencyObject element, bool value)
{ {
element.SetValue(IsEnableInertiaProperty, value); element.SetValue(IsInertiaEnabledProperty, value);
} }
public static bool GetIsEnableInertia(DependencyObject element) public static bool GetIsInertiaEnabled(DependencyObject element)
{ {
return (bool)element.GetValue(IsEnableInertiaProperty); return (bool)element.GetValue(IsInertiaEnabledProperty);
} }
/// <summary> /// <summary>
/// 是否支持惯性 /// 是否支持惯性
/// </summary> /// </summary>
public bool IsEnableInertia public bool IsInertiaEnabled
{ {
get => (bool) GetValue(IsEnableInertiaProperty); get => (bool) GetValue(IsInertiaEnabledProperty);
set => SetValue(IsEnableInertiaProperty, value); set => SetValue(IsInertiaEnabledProperty, value);
} }
/// <summary> /// <summary>
@@ -50,16 +50,16 @@ namespace HandyControl.Controls
/// <summary> /// <summary>
/// 是否启用动画 /// 是否启用动画
/// </summary> /// </summary>
public static readonly DependencyProperty IsEnableAnimationProperty = DependencyProperty.Register( public static readonly DependencyProperty IsAnimationEnabledProperty = DependencyProperty.Register(
"IsEnableAnimation", typeof(bool), typeof(TabControl), new PropertyMetadata(ValueBoxes.FalseBox)); "IsAnimationEnabled", typeof(bool), typeof(TabControl), new PropertyMetadata(ValueBoxes.FalseBox));
/// <summary> /// <summary>
/// 是否启用动画 /// 是否启用动画
/// </summary> /// </summary>
public bool IsEnableAnimation public bool IsAnimationEnabled
{ {
get => (bool)GetValue(IsEnableAnimationProperty); get => (bool)GetValue(IsAnimationEnabledProperty);
set => SetValue(IsEnableAnimationProperty, value); set => SetValue(IsAnimationEnabledProperty, value);
} }
/// <summary> /// <summary>
@@ -122,16 +122,16 @@ namespace HandyControl.Controls
/// <summary> /// <summary>
/// 是否将标签填充 /// 是否将标签填充
/// </summary> /// </summary>
public static readonly DependencyProperty IsEnableTabFillProperty = DependencyProperty.Register( public static readonly DependencyProperty IsTabFillEnabledProperty = DependencyProperty.Register(
"IsEnableTabFill", typeof(bool), typeof(TabControl), new PropertyMetadata(ValueBoxes.FalseBox)); "IsTabFillEnabled", typeof(bool), typeof(TabControl), new PropertyMetadata(ValueBoxes.FalseBox));
/// <summary> /// <summary>
/// 是否将标签填充 /// 是否将标签填充
/// </summary> /// </summary>
public bool IsEnableTabFill public bool IsTabFillEnabled
{ {
get => (bool)GetValue(IsEnableTabFillProperty); get => (bool)GetValue(IsTabFillEnabledProperty);
set => SetValue(IsEnableTabFillProperty, value); set => SetValue(IsTabFillEnabledProperty, value);
} }
/// <summary> /// <summary>
@@ -224,7 +224,7 @@ namespace HandyControl.Controls
return; return;
} }
if (!IsEnableTabFill) if (!IsTabFillEnabled)
{ {
_itemShowCount = (int)(ActualWidth / TabItemWidth); _itemShowCount = (int)(ActualWidth / TabItemWidth);
_buttonOverflow?.Show(ShowOverflowButton && Items.Count > 0 && Items.Count >= _itemShowCount); _buttonOverflow?.Show(ShowOverflowButton && Items.Count > 0 && Items.Count >= _itemShowCount);
@@ -236,7 +236,7 @@ namespace HandyControl.Controls
return; return;
} }
if (IsEnableAnimation) if (IsAnimationEnabled)
{ {
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200))); HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
} }
@@ -279,7 +279,7 @@ namespace HandyControl.Controls
base.OnApplyTemplate(); base.OnApplyTemplate();
HeaderPanel = GetTemplateChild(HeaderPanelKey) as TabPanel; HeaderPanel = GetTemplateChild(HeaderPanelKey) as TabPanel;
if (IsEnableTabFill) return; if (IsTabFillEnabled) return;
_buttonOverflow = GetTemplateChild(OverflowButtonKey) as ContextMenuToggleButton; _buttonOverflow = GetTemplateChild(OverflowButtonKey) as ContextMenuToggleButton;
_scrollViewerOverflow = GetTemplateChild(OverflowScrollviewer) as ScrollViewer; _scrollViewerOverflow = GetTemplateChild(OverflowScrollviewer) as ScrollViewer;
@@ -357,7 +357,7 @@ namespace HandyControl.Controls
{ {
list.Remove(actualItem); list.Remove(actualItem);
list.Insert(0, actualItem); list.Insert(0, actualItem);
if (IsEnableAnimation) if (IsAnimationEnabled)
{ {
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200))); HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
} }
@@ -278,7 +278,7 @@ namespace HandyControl.Controls
RaiseEvent(argsClosing); RaiseEvent(argsClosing);
if (argsClosing.Cancel) return; if (argsClosing.Cancel) return;
TabPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, parent.IsEnableAnimation TabPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, parent.IsAnimationEnabled
? new Duration(TimeSpan.FromMilliseconds(200)) ? new Duration(TimeSpan.FromMilliseconds(200))
: new Duration(TimeSpan.FromMilliseconds(1))); : new Duration(TimeSpan.FromMilliseconds(1)));
@@ -419,7 +419,7 @@ namespace HandyControl.Controls
} }
TargetOffsetX = resultX; TargetOffsetX = resultX;
if (!parent.IsEnableAnimation) if (!parent.IsAnimationEnabled)
{ {
AnimationCompleted(); AnimationCompleted();
return; return;
@@ -40,16 +40,16 @@ namespace HandyControl.Controls
/// <summary> /// <summary>
/// 是否将标签填充 /// 是否将标签填充
/// </summary> /// </summary>
public static readonly DependencyProperty IsEnableTabFillProperty = DependencyProperty.Register( public static readonly DependencyProperty IsTabFillEnabledProperty = DependencyProperty.Register(
"IsEnableTabFill", typeof(bool), typeof(TabPanel), new PropertyMetadata(ValueBoxes.FalseBox)); "IsTabFillEnabled", typeof(bool), typeof(TabPanel), new PropertyMetadata(ValueBoxes.FalseBox));
/// <summary> /// <summary>
/// 是否将标签填充 /// 是否将标签填充
/// </summary> /// </summary>
public bool IsEnableTabFill public bool IsTabFillEnabled
{ {
get => (bool)GetValue(IsEnableTabFillProperty); get => (bool)GetValue(IsTabFillEnabledProperty);
set => SetValue(IsEnableTabFillProperty, value); set => SetValue(IsTabFillEnabledProperty, value);
} }
/// <summary> /// <summary>
@@ -115,7 +115,7 @@ namespace HandyControl.Controls
var itemWidth = .0; var itemWidth = .0;
var arr = new int[count]; var arr = new int[count];
if (!IsEnableTabFill) if (!IsTabFillEnabled)
{ {
itemWidth = TabItemWidth; itemWidth = TabItemWidth;
} }
@@ -129,7 +129,7 @@ namespace HandyControl.Controls
for (var index = 0; index < count; index++) for (var index = 0; index < count; index++)
{ {
if (IsEnableTabFill) if (IsTabFillEnabled)
{ {
itemWidth = arr[index]; itemWidth = arr[index];
} }
@@ -91,7 +91,7 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}"> <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"> <controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsTabFillEnabled="{TemplateBinding IsTabFillEnabled}" 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}">
<interactivity:FluidMoveBehavior.EaseX> <interactivity:FluidMoveBehavior.EaseX>
@@ -129,9 +129,9 @@
</Border.CacheMode> </Border.CacheMode>
<RepeatButton Focusable="False" Style="{StaticResource RepeatButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonLeft"/> <RepeatButton Focusable="False" Style="{StaticResource RepeatButtonIcon}" 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" IsInertiaEnabled="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}" Name="PART_HeaderBorder"> <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}" IsTabFillEnabled="{TemplateBinding IsTabFillEnabled}" 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}">
<interactivity:FluidMoveBehavior.EaseX> <interactivity:FluidMoveBehavior.EaseX>
@@ -171,7 +171,7 @@
<MultiTrigger> <MultiTrigger>
<MultiTrigger.Conditions> <MultiTrigger.Conditions>
<Condition Property="IsScrollable" Value="True"/> <Condition Property="IsScrollable" Value="True"/>
<Condition Property="IsEnableTabFill" Value="False"/> <Condition Property="IsTabFillEnabled" Value="False"/>
</MultiTrigger.Conditions> </MultiTrigger.Conditions>
<Setter Property="Template" Value="{StaticResource TabControlPlusScrollableTemplate}"/> <Setter Property="Template" Value="{StaticResource TabControlPlusScrollableTemplate}"/>
</MultiTrigger> </MultiTrigger>