Skip to content

Commit f001a07

Browse files
Rename TabScrollDirection
1 parent 9631e7a commit f001a07

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/MaterialDesignThemes.Wpf/Behaviors/Internal/TabControlHeaderScrollBehavior.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics;
1+
using System.Diagnostics;
22
using System.Windows.Media.Animation;
33
using Microsoft.Xaml.Behaviors;
44

@@ -17,11 +17,11 @@ private static void CustomHorizontalOffsetChanged(DependencyObject d, Dependency
1717
scrollViewer.ScrollToHorizontalOffset((double)e.NewValue);
1818
}
1919

20-
public static readonly DependencyProperty TabScrollDirectionProperty =
21-
DependencyProperty.RegisterAttached("TabScrollDirection", typeof(TabScrollDirection),
20+
public static readonly DependencyProperty ScrollDirectionProperty =
21+
DependencyProperty.RegisterAttached("ScrollDirection", typeof(TabScrollDirection),
2222
typeof(TabControlHeaderScrollBehavior), new PropertyMetadata(TabScrollDirection.Unknown));
23-
public static TabScrollDirection GetTabScrollDirection(DependencyObject obj) => (TabScrollDirection)obj.GetValue(TabScrollDirectionProperty);
24-
public static void SetTabScrollDirection(DependencyObject obj, TabScrollDirection value) => obj.SetValue(TabScrollDirectionProperty, value);
23+
public static TabScrollDirection GetScrollDirection(DependencyObject obj) => (TabScrollDirection)obj.GetValue(ScrollDirectionProperty);
24+
public static void SetScrollDirection(DependencyObject obj, TabScrollDirection value) => obj.SetValue(ScrollDirectionProperty, value);
2525

2626
public TabControl TabControl
2727
{
@@ -75,7 +75,7 @@ private void OnTabChanged(object sender, SelectionChangedEventArgs e)
7575
if (e.AddedItems.Count > 0)
7676
{
7777
_desiredScrollStart = AssociatedObject.ContentHorizontalOffset;
78-
SetTabScrollDirection(tabControl, (IsMovingForward() ? TabScrollDirection.Forward : TabScrollDirection.Backward));
78+
SetScrollDirection(tabControl, (IsMovingForward() ? TabScrollDirection.Forward : TabScrollDirection.Backward));
7979
}
8080

8181
bool IsMovingForward()

src/MaterialDesignThemes.Wpf/Internal/PaddedBringIntoViewStackPanel.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace MaterialDesignThemes.Wpf.Internal;
55

66
public class PaddedBringIntoViewStackPanel : StackPanel
77
{
8-
public TabScrollDirection TabScrollDirection
8+
public TabScrollDirection ScrollDirection
99
{
10-
get => (TabScrollDirection)GetValue(TabScrollDirectionProperty);
11-
set => SetValue(TabScrollDirectionProperty, value);
10+
get => (TabScrollDirection)GetValue(ScrollDirectionProperty);
11+
set => SetValue(ScrollDirectionProperty, value);
1212
}
1313

14-
public static readonly DependencyProperty TabScrollDirectionProperty =
15-
DependencyProperty.Register(nameof(TabScrollDirection), typeof(TabScrollDirection),
14+
public static readonly DependencyProperty ScrollDirectionProperty =
15+
DependencyProperty.Register(nameof(ScrollDirection), typeof(TabScrollDirection),
1616
typeof(PaddedBringIntoViewStackPanel), new PropertyMetadata(TabScrollDirection.Unknown));
1717

1818
public double TabScrollOffset
@@ -34,8 +34,8 @@ private void OnRequestBringIntoView(object sender, RoutedEventArgs e)
3434
{
3535
e.Handled = true;
3636

37-
// TODO: Consider making the "TabScrollDirection" a destructive read (i.e. reset the value once it is read) to avoid leaving a Backward/Forward value that may be misinterpreted at a later stage.
38-
double offset = TabScrollDirection switch {
37+
// TODO: Consider making the "ScrollDirection" a destructive read (i.e. reset the value once it is read) to avoid leaving a Backward/Forward value that may be misinterpreted at a later stage.
38+
double offset = ScrollDirection switch {
3939
TabScrollDirection.Backward => -TabScrollOffset,
4040
TabScrollDirection.Forward => TabScrollOffset,
4141
_ => 0

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<behaviorsInternal:TabControlHeaderScrollBehavior TabControl="{Binding RelativeSource={RelativeSource TemplatedParent}}" ScrollableContent="{Binding ElementName=ScrollableContent}" />
4444
</b:Interaction.Behaviors>
4545
<internal:PaddedBringIntoViewStackPanel x:Name="ScrollableContent"
46-
TabScrollDirection="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(behaviorsInternal:TabControlHeaderScrollBehavior.TabScrollDirection)}"
46+
ScrollDirection="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(behaviorsInternal:TabControlHeaderScrollBehavior.ScrollDirection)}"
4747
TabScrollOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:TabAssist.TabScrollOffset)}">
4848
<UniformGrid x:Name="CenteredHeaderPanel"
4949
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"

0 commit comments

Comments
 (0)