Skip to content

Commit

Permalink
1.1.17.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia committed Feb 20, 2024
1 parent b6d4c18 commit f8aa25c
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 247 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static void SetCornerRadius(Control control, CornerRadius value)
}

public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(VisualStateHelper));
DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(VisualStateHelper), new FrameworkPropertyMetadata(new CornerRadius(), FrameworkPropertyMetadataOptions.Inherits));
#endregion

#region WatermarkForeground
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,6 @@
<core:SharedResourceDictionary Source="pack://application:,,,/Panuon.WPF.UI;component/Templates/ContextMenuItemTemplate.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="{ComponentResourceKey ResourceId=ArrowIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}">
<TextBlock Text="&#xe902;"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="{Binding FontSize, RelativeSource={RelativeSource AncestorType=MenuItem}, Mode=OneWay}"
Foreground="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource AncestorType=MenuItem}, Mode=OneWay}"
FontFamily="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon"
Margin="0,0,5,0" />
</DataTemplate>

<DataTemplate x:Key="{ComponentResourceKey ResourceId=CheckedIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}">
<TextBlock Text="&#xe92e;"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ContentControl}, Mode=OneWay}"
FontSize="{Binding FontSize, RelativeSource={RelativeSource AncestorType=MenuItem}, Mode=OneWay}"
FontFamily="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon" />
</DataTemplate>

<Style x:Key="{x:Static rs:StyleKeys.ContextMenuItemStyle}"
TargetType="MenuItem">
<Setter Property="i:VisualStateHelper.Regist"
Expand Down Expand Up @@ -170,34 +151,6 @@
Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
Value="Disabled" />
<Setter Property="local:ContextMenuHelper.ItemsPadding"
Value="5,0" />
<Setter Property="local:ContextMenuHelper.ItemsHeight"
Value="30" />
<Setter Property="local:ContextMenuHelper.ItemsWidth">
<Setter.Value>
<MultiBinding Converter="{StaticResource {x:Static irs:ConverterKeys.DropDownMinWidthConverter}}">
<Binding Path="ActualWidth"
RelativeSource="{RelativeSource Self}"
Mode="OneWay" />
<Binding Path="(local:ShadowHelper.BlurRadius)"
RelativeSource="{RelativeSource Self}"
Mode="OneWay" />
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="local:ContextMenuHelper.ItemsSeparatorBrush"
Value="#E6E6E6" />
<Setter Property="local:ContextMenuHelper.ItemsSeparatorThickness"
Value="1" />
<Setter Property="local:ContextMenuHelper.ItemsSeparatorVisibility"
Value="Collapsed" />
<Setter Property="local:ContextMenuHelper.ItemsBackground"
Value="Transparent" />
<Setter Property="local:ContextMenuHelper.ItemsHoverBackground"
Value="#F1F1F1" />
<Setter Property="local:ContextMenuHelper.ItemsIconWidth"
Value="{Binding Path=(local:ContextMenuHelper.ItemsHeight), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:DropDownHelper.CornerRadius"
Value="{Binding Path=(local:ContextMenuHelper.CornerRadius), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:DropDownHelper.Background"
Expand Down Expand Up @@ -228,22 +181,28 @@
Value="{Binding Path=(local:ContextMenuHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Background"
Value="{Binding Path=(local:ContextMenuHelper.Background), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="BorderBrush"
Value="{Binding Path=(local:ContextMenuHelper.BorderBrush), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="BorderThickness"
Value="{Binding Path=(local:ContextMenuHelper.BorderThickness), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="VerticalOffset"
Value="{Binding Path=(local:ShadowHelper.BlurRadius), Converter={StaticResource {x:Static rs:ConverterKeys.DoubleMultiplyByConverter}}, ConverterParameter=-1, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="HorizontalOffset"
Value="{Binding Path=(local:ShadowHelper.BlurRadius), Converter={StaticResource {x:Static rs:ConverterKeys.DoubleMultiplyByConverter}}, ConverterParameter=-1, RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:ContextMenuHelper.ArrowIconTemplate"
Value="{StaticResource {ComponentResourceKey ResourceId=ArrowIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}}" />
<Setter Property="local:ContextMenuHelper.CheckedIconTemplate"
Value="{StaticResource {ComponentResourceKey ResourceId=CheckedIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}}" />
<Setter Property="Padding"
Value="0" />
<Setter Property="BorderBrush"
Value="{Binding Path=(local:ContextMenuHelper.BorderBrush), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
Value="{Binding Path=(local:ContextMenuHelper.Padding), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Width"
Value="200" />
Value="{Binding Path=(local:ContextMenuHelper.Width), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MinWidth"
Value="{Binding Path=(local:ContextMenuHelper.MinWidth), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MaxWidth"
Value="{Binding Path=(local:ContextMenuHelper.MaxWidth), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Height"
Value="{Binding Path=(local:ContextMenuHelper.Height), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MinHeight"
Value="{Binding Path=(local:ContextMenuHelper.MinHeight), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MaxHeight"
Value="{Binding Path=(local:ContextMenuHelper.MaxHeight), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Template"
Value="{StaticResource {x:Static irs:TemplateKeys.ContextMenuTemplate}}" />
<Style.Triggers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
Value="True" />
<Setter Property="FocusVisualStyle"
Value="{Binding FocusVisualStyle, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="Width"
Value="{Binding Path=(local:ToolTipHelper.Width), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MinWidth"
Value="{Binding Path=(local:ToolTipHelper.MinWidth), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MaxWidth"
Value="{Binding Path=(local:ToolTipHelper.MaxWidth), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Height"
Value="{Binding Path=(local:ToolTipHelper.Height), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MinHeight"
Value="{Binding Path=(local:ToolTipHelper.MinHeight), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="MaxHeight"
Value="{Binding Path=(local:ToolTipHelper.MaxHeight), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Foreground"
Value="{Binding Path=(local:ToolTipHelper.Foreground), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="Background"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@
<core:SharedResourceDictionary Source="pack://application:,,,/Panuon.WPF.UI;component/Resources/Converters.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="{ComponentResourceKey ResourceId=ArrowIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}">
<TextBlock Text="&#xe902;"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="{Binding FontSize, RelativeSource={RelativeSource AncestorType=MenuItem}, Mode=OneWay}"
Foreground="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource AncestorType=MenuItem}, Mode=OneWay}"
FontFamily="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon"
Margin="0,0,5,0" />
</DataTemplate>

<DataTemplate x:Key="{ComponentResourceKey ResourceId=CheckedIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}">
<TextBlock Text="&#xe92e;"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ContentControl}, Mode=OneWay}"
FontSize="{Binding FontSize, RelativeSource={RelativeSource AncestorType=MenuItem}, Mode=OneWay}"
FontFamily="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon" />
</DataTemplate>

<ControlTemplate x:Key="{x:Static irs:TemplateKeys.ContextMenuItemTemplate}"
TargetType="MenuItem">
<Grid>
Expand All @@ -34,7 +53,8 @@
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Width="{Binding Path=(local:ContextMenuHelper.ItemsIconWidth), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}">
<Grid x:Name="GrdIcon"
Width="{Binding Path=(local:ContextMenuHelper.ItemsHeight), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}">
<i:IconPresenter x:Name="IpIcon"
Content="{TemplateBinding Icon}"
Margin="{Binding Path=(local:IconHelper.Margin), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Expand Down Expand Up @@ -76,18 +96,19 @@
FontSize="{Binding Path=(local:IconHelper.FontSize), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}"
Foreground="{Binding Path=(local:IconHelper.Foreground), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}"
ToolTip="{Binding Path=(local:IconHelper.ToolTip), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}"
ContentTemplate="{Binding Path=(local:ContextMenuHelper.CheckedIconTemplate), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}" />
ContentTemplate="{StaticResource {ComponentResourceKey ResourceId=CheckedIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}}" />
</Grid>
<ContentPresenter x:Name="CpHeader"
Grid.Column="1"
RecognizesAccessKey="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
ContentSource="Header" />
<ContentControl Grid.Column="2"
<ContentControl x:Name="CcArrow"
Grid.Column="2"
Visibility="{Binding HasItems, Converter={StaticResource {x:Static rs:ConverterKeys.FalseToCollapseConverter}}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Foreground="{Binding Path=(i:VisualStateHelper.Foreground) ,RelativeSource={RelativeSource AncestorType=MenuItem}, Mode=OneWay}"
ContentTemplate="{Binding Path=(local:ContextMenuHelper.ArrowIconTemplate), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}" />
ContentTemplate="{StaticResource {ComponentResourceKey ResourceId=ArrowIconTemplateKey, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}}" />
</Grid>
</Border>
<local:PopupX x:Name="popDropDown"
Expand Down Expand Up @@ -198,9 +219,27 @@
Fill="{Binding Path=(local:MenuItemHelper.SeparatorBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Height="{Binding Path=(local:MenuItemHelper.SeparatorThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Margin="{Binding Path=(local:MenuItemHelper.SeparatorMargin), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Visibility="{Binding Path=(local:MenuItemHelper.SeparatorVisibility), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
Visibility="{Binding Path=( local:MenuItemHelper.SeparatorVisibility), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
</Grid>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=(local:ContextMenuHelper.ItemsIconWidth), Converter={StaticResource {x:Static rs:ConverterKeys.IsNonnullConverter}}, RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}"
Value="True">
<Setter TargetName="GrdIcon"
Property="Width"
Value="{Binding Path=(local:ContextMenuHelper.ItemsIconWidth), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=(local:ContextMenuHelper.ArrowIconTemplate), Converter={StaticResource {x:Static rs:ConverterKeys.IsNonnullConverter}}, RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}"
Value="True">
<Setter TargetName="CcArrow"
Property="ContentTemplate"
Value="{Binding Path=(local:ContextMenuHelper.ArrowIconTemplate), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=(local:ContextMenuHelper.CheckedIconTemplate), Converter={StaticResource {x:Static rs:ConverterKeys.IsNonnullConverter}}, RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}"
Value="True">
<Setter TargetName="CcChecked"
Property="ContentTemplate"
Value="{Binding Path=(local:ContextMenuHelper.CheckedIconTemplate), RelativeSource={RelativeSource AncestorType=ContextMenu}, Mode=OneWay}" />
</DataTrigger>
<DataTrigger Value="False">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource {x:Static irs:ConverterKeys.IsItemSeparatorShallVisibleControlConverter}}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
</MultiBinding>
</Border.Effect>
</Border>
<Border Padding="{Binding Path=(i:VisualStateHelper.BorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Margin="{Binding Path=(local:ShadowHelper.BlurRadius), Converter={StaticResource {x:Static irs:ConverterKeys.DropDownMarginConverter}}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
<ScrollViewer>
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle" />
</ScrollViewer>
<Border Margin="{Binding Path=(local:ContextMenuHelper.Padding), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
<Border Padding="{Binding Path=(i:VisualStateHelper.BorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Margin="{Binding Path=(local:ShadowHelper.BlurRadius), Converter={StaticResource {x:Static irs:ConverterKeys.DropDownMarginConverter}}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
<ScrollViewer>
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle" />
</ScrollViewer>
</Border>
</Border>
</Grid>
</ControlTemplate>
Expand Down
Loading

0 comments on commit f8aa25c

Please sign in to comment.