Skip to content

Commit

Permalink
1.2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia committed May 17, 2024
1 parent b472d1d commit 42fd4c3
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
Value="Center" />
<Setter Property="FontFamily"
Value="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon" />
<Setter Property="FontSize"
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Expand Down Expand Up @@ -88,6 +90,8 @@
Value="{Binding IconFontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding IconFontSize, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.ToggleArrowFontSize"
Value="{Binding FontSize, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Margin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
Value="Center" />
<Setter Property="FontFamily"
Value="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon" />
<Setter Property="FontSize"
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Expand Down Expand Up @@ -116,6 +118,8 @@
Value="{Binding IconFontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding IconFontSize, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.ToggleArrowFontSize"
Value="{Binding FontSize, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Margin"
Expand Down Expand Up @@ -260,5 +264,5 @@
</MultiDataTrigger>
</Style.Triggers>
</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
Value="Center" />
<Setter Property="FontFamily"
Value="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon" />
<Setter Property="FontSize"
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Expand Down Expand Up @@ -168,6 +170,8 @@
Value="{Binding IconFontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding IconFontSize, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.ToggleArrowFontSize"
Value="{Binding FontSize, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Margin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Value="Center" />
<Setter Property="FontFamily"
Value="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon" />
<Setter Property="FontSize"
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Foreground"
Expand Down Expand Up @@ -102,6 +104,8 @@
Value="{Binding IconFontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding IconFontSize, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.ToggleArrowFontSize"
Value="{Binding FontSize, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="FocusVisualStyle"
Value="{Binding FocusVisualStyle, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:ExpanderHelper.HeaderSeparatorBrush"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
Value="Center" />
<Setter Property="FontFamily"
Value="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon" />
<Setter Property="FontSize"
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Expand Down Expand Up @@ -119,6 +121,8 @@
Value="{Binding IconFontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding IconFontSize, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.ToggleArrowFontSize"
Value="{Binding FontSize, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Margin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ public DataTemplate SpecialDayHighlightTemplate
#endregion

#region Overrides
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
{
e.Handled = true;
base.OnPreviewMouseDown(e);
base.OnPreviewMouseLeftButtonDown(e);
if (CanSelect)
{
RaiseEvent(new RoutedEventArgs(SelectedEvent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ private static void OnMouseButtonDown(object sender, MouseButtonEventArgs e)

private static void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e)
{
if(e.LeftButton != MouseButtonState.Pressed)
{
return;
}
var colorPicker = (ColorPicker)sender;
if (colorPicker.IsEditable)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ public override void OnApplyTemplate()
_thumbFence.ThumbPositionChanged += ThumbFence_PositionChanged;

_dropperThumb = GetTemplateChild(DropperThumbTemplateName) as Thumb;
_dropperThumb.PreviewMouseDown += DropperThumb_PreviewMouseDown;
_dropperThumb.PreviewMouseUp += DropperThumb_PreviewMouseUp;
_dropperThumb.PreviewMouseLeftButtonDown += DropperThumb_PreviewMouseLeftButtonDown;
_dropperThumb.PreviewMouseLeftButtonUp += DropperThumb_PreviewMouseLeftButtonUp;
_dropperThumb.DragDelta += DropperThumb_DragDelta;
_dropperThumb.DragStarted += DropperThumb_DragStarted;
_dropperThumb.DragCompleted += _dropperThumb_DragCompleted;
Expand Down Expand Up @@ -313,12 +313,12 @@ private void _dropperThumb_DragCompleted(object sender, DragCompletedEventArgs e
Cursor = Cursors.Arrow;
}

private void DropperThumb_PreviewMouseDown(object sender, MouseButtonEventArgs e)
private void DropperThumb_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Cursor = CursorUtil.DropperCursor;
}

private void DropperThumb_PreviewMouseUp(object sender, MouseButtonEventArgs e)
private void DropperThumb_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Cursor = Cursors.Arrow;
}
Expand Down
15 changes: 15 additions & 0 deletions SourceCode/SharedResources/Panuon.WPF.UI/Helpers/IconHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,21 @@ public static void SetFontSize(DependencyObject obj, double value)
DependencyProperty.RegisterAttached("FontSize", typeof(double), typeof(IconHelper), new PropertyMetadata(12.0));
#endregion

#region ToggleArrowFontSize
public static double GetToggleArrowFontSize(DependencyObject obj)
{
return (double)obj.GetValue(ToggleArrowFontSizeProperty);
}

public static void SetToggleArrowFontSize(DependencyObject obj, double value)
{
obj.SetValue(ToggleArrowFontSizeProperty, value);
}

public static readonly DependencyProperty ToggleArrowFontSizeProperty =
DependencyProperty.RegisterAttached("ToggleArrowFontSize", typeof(double), typeof(IconHelper), new PropertyMetadata(12.0));
#endregion

#region FontFamily
public static FontFamily GetFontFamily(DependencyObject obj)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ internal static void SetRegist(ListBoxItem listBoxItem, bool value)
private static void OnRegistChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var listBoxItem = d as ListBoxItem;
listBoxItem.PreviewMouseDown += ListBoxItem_PreviewMouseDown;
listBoxItem.PreviewMouseLeftButtonDown += ListBoxItem_PreviewMouseDown;
}

private static void ListBoxItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,33 @@ public static void SetAnimationDuration(DependencyObject obj, TimeSpan value)
#endregion

#region MouseWheelDelta
public static double GetMouseWheelDelta(DependencyObject obj)
public static double? GetMouseWheelDelta(DependencyObject obj)
{
return (double)obj.GetValue(MouseWheelDeltaProperty);
}

public static void SetMouseWheelDelta(DependencyObject obj, double value)
public static void SetMouseWheelDelta(DependencyObject obj, double? value)
{
obj.SetValue(MouseWheelDeltaProperty, value);
}

public static readonly DependencyProperty MouseWheelDeltaProperty =
DependencyProperty.RegisterAttached("MouseWheelDelta", typeof(double), typeof(ScrollViewerHelper), new FrameworkPropertyMetadata(48d, FrameworkPropertyMetadataOptions.Inherits));
DependencyProperty.RegisterAttached("MouseWheelDelta", typeof(double?), typeof(ScrollViewerHelper), new FrameworkPropertyMetadata(48d, FrameworkPropertyMetadataOptions.Inherits));
#endregion

#region MouseWheelUnit
public static int GetMouseWheelUnit(DependencyObject obj)
{
return (int)obj.GetValue(MouseWheelUnitProperty);
}

public static void SetMouseWheelUnit(DependencyObject obj, int value)
{
obj.SetValue(MouseWheelUnitProperty, value);
}

public static readonly DependencyProperty MouseWheelUnitProperty =
DependencyProperty.RegisterAttached("MouseWheelUnit", typeof(int), typeof(ScrollViewerHelper), new FrameworkPropertyMetadata(1, FrameworkPropertyMetadataOptions.Inherits));
#endregion

#region VerticalOffset
Expand Down Expand Up @@ -341,17 +356,28 @@ private static void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEven
}
}

var mouseWheelDelta = GetMouseWheelDelta(scrollViewer);
if (scrollViewer.CanContentScroll)
var mouseWheelDelta = 48d;
if (scrollViewer.CanContentScroll)
{
if (scrollViewer.ViewportHeight != scrollViewer.ActualHeight) //Excluding WrapPanel
if (GetMouseWheelUnit(scrollViewer) is int unit)
{
mouseWheelDelta = unit;
}
else
{
mouseWheelDelta = 3;
mouseWheelDelta = 1;
}
}
else if (scrollViewer.ViewportHeight != scrollViewer.ActualHeight)
else
{
mouseWheelDelta = scrollViewer.ViewportHeight;
if (GetMouseWheelDelta(scrollViewer) is double delta)
{
mouseWheelDelta = delta;
}
else if (scrollViewer.ViewportHeight != scrollViewer.ActualHeight)
{
mouseWheelDelta = scrollViewer.ViewportHeight;
}
}

switch (GetWheelScrollingDirection(scrollViewer))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
ResourceDictionaryLocation.SourceAssembly
)]

[assembly: AssemblyVersion("1.2.1.2")]
[assembly: AssemblyFileVersion("1.2.1.2")]
[assembly: AssemblyVersion("1.2.1.3")]
[assembly: AssemblyFileVersion("1.2.1.3")]

0 comments on commit 42fd4c3

Please sign in to comment.