Skip to content

Commit

Permalink
v2.2.11.1 (#22)
Browse files Browse the repository at this point in the history
* v2.2.11.1-alpha (#21)
  • Loading branch information
Mochengvia authored Jul 26, 2021
1 parent 6c0a726 commit 4f8a269
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 92 deletions.
3 changes: 2 additions & 1 deletion DotNet/WPF/Src/Samples/Views/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
ToolTip="Panuon IconFont Browser"
Style="{StaticResource {ComponentResourceKey ResourceId=WindowXMinimizeButtonStyle, TypeInTargetAssembly={x:Type pu:WindowX}}}"
Content=""
Click="BtnIconFont_Click" />
Click="BtnIconFont_Click">
</Button>
</StackPanel>
</pu:WindowXCaption.ExtendControl>
<Grid Margin="20,10,20,20">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public override object Convert(object[] values, Type targetType, object paramete
{
var actualWidth = (double)values[0];
var blurRadius = (double)values[1];
return actualWidth + blurRadius * 2;
return actualWidth - blurRadius * 2;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Templates\FromGroupTemplate.xaml">
<Page Include="$(MSBuildThisFileDirectory)Templates\FormGroupTemplate.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@

<Style x:Key="{x:Static rs:StyleKeys.ContextMenuStyle}"
TargetType="{x:Type ContextMenu}">
<Style.Resources>
<Style TargetType="MenuItem"
BasedOn="{StaticResource {ComponentResourceKey ResourceId=MenuItemStyle, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}}" />
</Style.Resources>
<Setter Property="local:IconHelper.FontFamily"
Value="{Binding IconFontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.FontSize"
Expand Down Expand Up @@ -140,13 +144,21 @@
<Setter Property="Padding"
Value="{Binding (local:ContextMenuHelper.Padding), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:ContextMenuHelper.ItemsPadding"
Value="10,0" />
Value="5,0" />
<Setter Property="local:ContextMenuHelper.ItemsHeight"
Value="30" />
<Setter Property="local:ContextMenuHelper.ItemsIconWidth"
Value="{Binding Path=(local:ContextMenuHelper.ItemsHeight), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:ContextMenuHelper.ItemsWidth"
Value="NaN" />
<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"
Expand All @@ -157,14 +169,14 @@
Value="Transparent" />
<Setter Property="local:ContextMenuHelper.ItemsHoverBackground"
Value="#F1F1F1" />
<Setter Property="local:ContextMenuHelper.Placement"
<Setter Property="local:ContextMenuHelper.ItemsIconWidth"
Value="{Binding Path=(local:ContextMenuHelper.ItemsHeight), RelativeSource={RelativeSource Self}, Mode=OneWay}" />
<Setter Property="local:DropDownHelper.Placement"
Value="RightBottom" />
<Setter Property="Background"
Value="White" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Width"
Value="150" />
<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"
Expand All @@ -177,6 +189,8 @@
Value="0" />
<Setter Property="BorderBrush"
Value="LightGray" />
<Setter Property="Width"
Value="200" />
<Setter Property="Template"
Value="{StaticResource {x:Static irs:TemplateKeys.ContextMenuTemplate}}" />
<Style.Triggers>
Expand All @@ -186,9 +200,5 @@
Value="{Binding DisabledOpacity, Source={x:Static local:GlobalSettings.Setting}}" />
</Trigger>
</Style.Triggers>
<Style.Resources>
<Style TargetType="MenuItem"
BasedOn="{StaticResource {ComponentResourceKey ResourceId=MenuItemStyle, TypeInTargetAssembly={x:Type local:ContextMenuHelper}}}" />
</Style.Resources>
</Style>
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:rs="clr-namespace:Panuon.UI.Silver.Resources"
xmlns:irs="clr-namespace:Panuon.UI.Silver.Internal.Resources">
<ResourceDictionary.MergedDictionaries>
<core:SharedResourceDictionary Source="pack://application:,,,/Panuon.UI.Silver;component/Templates/FromGroupTemplate.xaml" />
<core:SharedResourceDictionary Source="pack://application:,,,/Panuon.UI.Silver;component/Templates/FormGroupTemplate.xaml" />
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="{ComponentResourceKey ResourceId=MessageTemplate, TypeInTargetAssembly={x:Type local:FormGroup}}">
Expand Down Expand Up @@ -71,7 +71,6 @@
Value="{Binding Foreground, RelativeSource={RelativeSource Self}}" />
<Setter Property="MessageTemplate"
Value="{StaticResource {ComponentResourceKey ResourceId=MessageTemplate, TypeInTargetAssembly={x:Type local:FormGroup}}}" />

<Style.Triggers>
<Trigger Property="Orientation"
Value="Vertical">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
CornerRadius="{Binding Path=(local:ContextMenuHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
CornerRadius="{Binding Path=(local:DropDownHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Margin="{Binding Path=(local:ShadowHelper.BlurRadius), Converter={StaticResource {x:Static irs:ConverterKeys.DropDownMarginConverter}}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
<i:ContentControlX.Effect>
<MultiBinding Converter="{StaticResource {x:Static irs:ConverterKeys.DropShadowEffectWithDepthConverter}}">
<Binding Path="(local:ContextMenuHelper.ShadowColor)"
<Binding Path="(local:DropDownHelper.ShadowColor)"
RelativeSource="{RelativeSource TemplatedParent}"
Mode="OneWay" />
<Binding Path="(local:ShadowHelper.BlurRadius)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@
TargetType="local:FormGroup">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="{Binding MessageHeight, Converter={StaticResource {x:Static rs:ConverterKeys.DoubleToGridLengthConverter}}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
MinHeight="{Binding MinMessageHeight, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
MaxHeight="{Binding MaxMessageHeight, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Style="{Binding Path=(local:ToggleButtonHelper.PendingSpinnerStyle), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
<ContentPresenter Grid.Row="1"
<ContentPresenter Grid.Column="1"
Focusable="False"
RecognizesAccessKey="True"
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Expand Down Expand Up @@ -103,7 +103,7 @@
Property="Content"
Value="{Binding Path=(local:ToggleButtonHelper.CheckedContent), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
</MultiDataTrigger>

</ControlTemplate.Triggers>
</ControlTemplate>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ public string GroupName
#region Overrides
public override void OnApplyTemplate()
{


_headerControl = GetTemplateChild(HeaderContentControlTemplateName) as ContentControl;
_headerControl.SizeChanged += HeaderControl_SizeChanged;
}
Expand Down Expand Up @@ -295,12 +295,12 @@ private void FormGroup_CollectSize(object sender, FormGroupCollectSizeEventArgs
{
if (e.Orientation == Orientation.Horizontal)
{
var width = GetComputedWidth();
var width = GetComputedWidth(false);
e.Maximuim = Math.Max(e.Maximuim, width);
}
else
{
var height = GetComputedHeight();
var height = GetComputedHeight(false);
e.Maximuim = Math.Max(e.Maximuim, height);
}
}
Expand Down Expand Up @@ -328,20 +328,36 @@ private static void OnGroupNameChanged(DependencyObject d, DependencyPropertyCha
#region Functions
private void DeteminingSize()
{
if(_headerControl == null)
if (_headerControl == null)
{
return;
}
var size = 0d;
if (Orientation == Orientation.Horizontal)
{
size = GetComputedWidth();
InternalHeaderHeight = GetComputedHeight();
size = GetComputedWidth(false);
var internalHeight = GetComputedHeight(true);
if (double.IsNaN(internalHeight))
{
FrameworkElementUtil.BindingProperty(this, InternalHeaderHeightProperty, this, ActualHeightProperty);
}
else
{
InternalHeaderHeight = internalHeight;
}
}
else
{
size = GetComputedHeight();
InternalHeaderWidth = GetComputedWidth();
size = GetComputedHeight(false);
var internalWidth = GetComputedWidth(true);
if (double.IsNaN(internalWidth))
{
FrameworkElementUtil.BindingProperty(this, InternalHeaderWidthProperty, this, ActualWidthProperty);
}
else
{
InternalHeaderWidth = internalWidth;
}
}
var collectSizeEventArgs = new FormGroupCollectSizeEventArgs(Orientation, size);
if (!string.IsNullOrEmpty(GroupName))
Expand All @@ -350,7 +366,7 @@ private void DeteminingSize()
}
if (Orientation == Orientation.Horizontal)
{
if(collectSizeEventArgs.Maximuim == InternalHeaderWidth)
if (collectSizeEventArgs.Maximuim == InternalHeaderWidth)
{
return;
}
Expand All @@ -371,23 +387,24 @@ private void DeteminingSize()
}
}

private double GetComputedWidth()
private double GetComputedWidth(bool allowNaN)
{
var size = GridLengthUtil.ComputeValue(RenderSize.Width, HeaderWidth);
if (double.IsNaN(size))
if (double.IsNaN(size) && !allowNaN)
{
_headerControl.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
size = _headerControl.DesiredSize.Width;
return _headerControl.DesiredSize.Width;
}
return size;
}

private double GetComputedHeight()
private double GetComputedHeight(bool allowNaN)
{
var size = GridLengthUtil.ComputeValue(RenderSize.Height, HeaderHeight);
if (double.IsNaN(size))
if (double.IsNaN(size) && !allowNaN)
{
size = _headerControl.DesiredSize.Height;
_headerControl.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
return _headerControl.DesiredSize.Height;
}
return size;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,51 +117,6 @@ public static void SetPadding(ContextMenu contextMenu, Thickness value)

#endregion

#region CornerRadius
public static CornerRadius GetCornerRadius(ContextMenu contextMenu)
{
return (CornerRadius)contextMenu.GetValue(CornerRadiusProperty);
}

public static void SetCornerRadius(ContextMenu contextMenu, CornerRadius value)
{
contextMenu.SetValue(CornerRadiusProperty, value);
}

public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ContextMenuHelper));
#endregion

#region ShadowColor
public static Color? GetShadowColor(ContextMenu contextMenu)
{
return (Color?)contextMenu.GetValue(ShadowColorProperty);
}

public static void SetShadowColor(ContextMenu contextMenu, Color? value)
{
contextMenu.SetValue(ShadowColorProperty, value);
}

public static readonly DependencyProperty ShadowColorProperty =
DependencyProperty.RegisterAttached("ShadowColor", typeof(Color?), typeof(ContextMenuHelper), new PropertyMetadata(Colors.LightGray));
#endregion

#region Placement
public static PopupXPlacement GetPlacement(ContextMenu contextMenu)
{
return (PopupXPlacement)contextMenu.GetValue(PlacementProperty);
}

public static void SetPlacement(ContextMenu contextMenu, PopupXPlacement value)
{
contextMenu.SetValue(PlacementProperty, value);
}

public static readonly DependencyProperty PlacementProperty =
DependencyProperty.RegisterAttached("Placement", typeof(PopupXPlacement), typeof(ContextMenuHelper), new PropertyMetadata(PopupXPlacement.BottomRight));
#endregion

#region Items

#region ItemsIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.11")]
[assembly: AssemblyFileVersion("2.2.11")]
[assembly: AssemblyVersion("2.2.11.1")]
[assembly: AssemblyFileVersion("2.2.11.1")]
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
### This project is still under development. Do not upgrade to this version rashly from the previous version, or use this version on urgent projects.

# Contributors
<img width="40" height="40" src="https://avatars.githubusercontent.com/u/23360265?v=4"></img>
<img width="40" height="40" src="https://avatars.githubusercontent.com/u/45651732?v=4"></img>
[<img width="40" height="40" src="https://avatars.githubusercontent.com/u/23360265?v=4"></img>](https://github.com/Mochengvia)
[<img width="40" height="40" src="https://avatars.githubusercontent.com/u/45651732?v=4"></img>](https://github.com/GodLeaveMe)

# Samples
`These pages were included in the Samples project. Download this repository to get the source code.`
Expand Down
6 changes: 2 additions & 4 deletions readme.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
[中文文档地址](http://yuque.com/mochengvia/silver2.2)

# 贡献
<img width="40" height="40" src="https://avatars.githubusercontent.com/u/23360265?v=4"></img>
<img width="40" height="40" src="https://avatars.githubusercontent.com/u/45651732?v=4"></img>


[<img width="40" height="40" src="https://avatars.githubusercontent.com/u/23360265?v=4"></img>](https://github.com/Mochengvia)
[<img width="40" height="40" src="https://avatars.githubusercontent.com/u/45651732?v=4"></img>](https://github.com/GodLeaveMe)

# 示例
`这些界面已包含在"Samples"项目中。下载本仓库即可获得这些页面的源码。`
Expand Down

0 comments on commit 4f8a269

Please sign in to comment.