Skip to content

Commit

Permalink
1.1.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia committed Jun 26, 2023
1 parent 965fe10 commit 26ac2ba
Show file tree
Hide file tree
Showing 35 changed files with 786 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,13 @@ static IconPresenter()
}
#endregion

#region Properties

#region Source
public FrameworkElement Source
{
get { return (FrameworkElement)GetValue(SourceProperty); }
set { SetValue(SourceProperty, value); }
}

public static readonly DependencyProperty SourceProperty =
DependencyProperty.Register("Source", typeof(FrameworkElement), typeof(IconPresenter), new PropertyMetadata(OnSourceChanged));
#endregion

#endregion

#region Overrides
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
}
#endregion

#region Event Handlers
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var presenter = d as IconPresenter;
presenter.UpdateBinding();
}
#endregion

#region Functions
private void UpdateBinding()
{
if (Source != null)
{

FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, HeightProperty, Source, IconHelper.HeightProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, WidthProperty, Source, IconHelper.WidthProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, VerticalContentAlignmentProperty, Source, IconHelper.VerticalAlignmentProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, HorizontalContentAlignmentProperty, Source, IconHelper.HorizontalAlignmentProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, MinWidthProperty, Source, IconHelper.MinWidthProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, MinHeightProperty, Source, IconHelper.MinHeightProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, MaxWidthProperty, Source, IconHelper.MaxWidthProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, MaxHeightProperty, Source, IconHelper.MaxHeightProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, MarginProperty, Source, IconHelper.MarginProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, FontFamilyProperty, Source, IconHelper.FontFamilyProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, ForegroundProperty, Source, IconHelper.ForegroundProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, FontSizeProperty, Source, IconHelper.FontSizeProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, ToolTipProperty, Source, IconHelper.ToolTipProperty);
FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, VisibilityProperty, this, ContentProperty,
(Source != null && IconHelper.GetHiddenOnNull(Source))
? (ValueConverterBase)new NullToHiddenConverter()
: new NullToCollapseConverter());
}
//FrameworkElementUtil.BindingPropertyIfUndefaultAndUninherited(this, VisibilityProperty, this, ContentProperty,
// (Source != null && IconHelper.GetHiddenOnNull(Source))
// ? (ValueConverterBase)new NullToHiddenConverter()
// : new NullToCollapseConverter());
}
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows;

namespace Panuon.WPF.UI.Internal.Converters
{
class IconVisibilityConverter
: OneWayMultiValueConverterBase
{
public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var icon = values[0];
var hidden = (bool)values[1];
return icon == null
? (hidden ? Visibility.Hidden : Visibility.Collapsed)
: Visibility.Visible;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Converters\DropDownOffsetConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\GroupBoxHeaderCornerRadiusConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\IconPlacementToDockConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\IconVisibilityConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\IsIntLessThanConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\IsIntGreaterThanConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Converters\IsDoubleLessThanConverter.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static class ConverterKeys
public const string GetTypeConverter = nameof(GetTypeConverter);
public const string GroupBoxHeaderCornerRadiusConverter = nameof(GroupBoxHeaderCornerRadiusConverter);
public const string IconPlacementToDockConverter = nameof(IconPlacementToDockConverter);
public const string IconVisibilityConverter = nameof(IconVisibilityConverter);
public const string InternalSpinClassicRenderTransformOriginConverter = nameof(InternalSpinClassicRenderTransformOriginConverter);
public const string IsEnumContainsInSpecificValueConverter = nameof(IsEnumContainsInSpecificValueConverter);
public const string IsItemSeparatorShallVisibleControlConverter = nameof(IsItemSeparatorShallVisibleControlConverter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<icv:GetTypeConverter x:Key="{x:Static irs:ConverterKeys.GetTypeConverter}" />
<icv:GroupBoxHeaderCornerRadiusConverter x:Key="{x:Static irs:ConverterKeys.GroupBoxHeaderCornerRadiusConverter}" />
<icv:IconPlacementToDockConverter x:Key="{x:Static irs:ConverterKeys.IconPlacementToDockConverter}" />
<icv:IconVisibilityConverter x:Key="{x:Static irs:ConverterKeys.IconVisibilityConverter}" />
<icv:IntDivideByConverter x:Key="{x:Static rs:ConverterKeys.IntDivideByConverter}" />
<icv:IsAllDoublesEqualConverter x:Key="{x:Static rs:ConverterKeys.IsAllDoublesEqualConverter}" />
<icv:IsDoubleEqualToConverter x:Key="{x:Static rs:ConverterKeys.IsDoubleEqualToConverter}" />
Expand Down Expand Up @@ -104,4 +105,5 @@
<icv:TrueToHiddenConverter x:Key="{x:Static rs:ConverterKeys.TrueToHiddenConverter}" />
<icv:WindowXCaptionDataContextConverter x:Key="{x:Static irs:ConverterKeys.WindowXCaptionDataContextConverter}" />
<icv:ZoomViewerViewboxScaleConverter x:Key="{x:Static irs:ConverterKeys.ZoomViewerViewboxScaleConverter}" />

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,30 @@
Value="True" />
<Setter Property="i:VisualStateHelper.IsHover"
Value="{Binding IsMouseOver, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.FontFamily"
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.Margin"
Value="0,0,5,0" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Margin"
Value="{Binding Path=(local:IconHelper.Margin), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Width"
Value="{Binding Path=(local:IconHelper.Width), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Height"
Value="{Binding Path=(local:IconHelper.Height), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.VerticalAlignment"
Value="{Binding Path=(local:IconHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.HorizontalAlignment"
Value="{Binding Path=(local:IconHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MinWidth"
Value="{Binding Path=(local:IconHelper.MinWidth), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MinHeight"
Value="{Binding Path=(local:IconHelper.MinHeight), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MaxWidth"
Value="{Binding Path=(local:IconHelper.MaxWidth), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MaxHeight"
Value="{Binding Path=(local:IconHelper.MaxHeight), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding Path=(local:IconHelper.FontSize), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="local:IconHelper.FontFamily"
Value="{Binding Path=(local:IconHelper.FontFamily), RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="Icon"
Value="{Binding ItemsIcon, RelativeSource={RelativeSource AncestorType=local:Breadcrumb}, Mode=OneWay}" />
<Setter Property="ShadowColor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,30 @@
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.Margin"
Value="0,0,5,0" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Margin"
Value="{Binding Path=(local:IconHelper.Margin), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Width"
Value="{Binding Path=(local:IconHelper.Width), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Height"
Value="{Binding Path=(local:IconHelper.Height), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.VerticalAlignment"
Value="{Binding Path=(local:IconHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.HorizontalAlignment"
Value="{Binding Path=(local:IconHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MinWidth"
Value="{Binding Path=(local:IconHelper.MinWidth), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MinHeight"
Value="{Binding Path=(local:IconHelper.MinHeight), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MaxWidth"
Value="{Binding Path=(local:IconHelper.MaxWidth), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MaxHeight"
Value="{Binding Path=(local:IconHelper.MaxHeight), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding Path=(local:IconHelper.FontSize), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="local:IconHelper.FontFamily"
Value="{Binding Path=(local:IconHelper.FontFamily), RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="Foreground"
Value="{Binding ItemsForeground, RelativeSource={RelativeSource AncestorType=local:CalendarX}, Mode=OneWay}" />
<Setter Property="Background"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,30 @@
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="local:IconHelper.FontFamily"
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.Margin"
Value="0,0,5,0" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Margin"
Value="{Binding Path=(local:IconHelper.Margin), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Width"
Value="{Binding Path=(local:IconHelper.Width), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.Height"
Value="{Binding Path=(local:IconHelper.Height), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.VerticalAlignment"
Value="{Binding Path=(local:IconHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.HorizontalAlignment"
Value="{Binding Path=(local:IconHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MinWidth"
Value="{Binding Path=(local:IconHelper.MinWidth), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MinHeight"
Value="{Binding Path=(local:IconHelper.MinHeight), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MaxWidth"
Value="{Binding Path=(local:IconHelper.MaxWidth), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.MaxHeight"
Value="{Binding Path=(local:IconHelper.MaxHeight), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding Path=(local:IconHelper.FontSize), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="local:IconHelper.FontFamily"
Value="{Binding Path=(local:IconHelper.FontFamily), RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="Icon"
Value="{Binding ItemsIcon, RelativeSource={RelativeSource AncestorType=local:SearchBox}, Mode=OneWay}" />
<Setter Property="ShadowColor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@
TargetType="local:TagItem">
<Setter Property="i:VisualStateHelper.Regist"
Value="True" />
<Setter Property="local:IconHelper.FontFamily"
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.Margin"
Value="0,0,5,0" />
<Setter Property="local:IconHelper.Foreground"
Value="{Binding Foreground, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Padding"
Value="5" />
<Setter Property="Background"
Expand Down
Loading

0 comments on commit 26ac2ba

Please sign in to comment.