Skip to content

Commit

Permalink
1.2.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia committed Jun 5, 2024
1 parent d7eb92b commit ce01b3b
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<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}" />
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=local:ColorPicker}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@
<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}" />
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=local:ColorPicker}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Value="4,0,8,0" />
<Setter Property="AnimationDuration"
Value="0:0:0.15" />
<Setter Property="Foreground"
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" />
Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource AncestorType=local:ColorPicker}, Mode=OneWay}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource AncestorType=ToggleButton}, Mode=OneWay}"
Value="True">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<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}" />
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=local:DateTimePicker}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<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}" />
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=Expander}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Foreground"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<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}" />
Value="{Binding Path=(local:IconHelper.ToggleArrowFontSize), RelativeSource={RelativeSource AncestorType=local:MultiComboBox}, Mode=OneWay}" />
<Setter Property="Content"
Value="&#xe903;" />
<Setter Property="Padding"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
TargetType="local:FormGroup">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding InternalHeaderHeight, Converter={x:Static pw:Converters.DoubleToGridLengthConverter}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
<RowDefinition Height="{Binding HeaderHeight, Converter={x:Static pw:Converters.DoubleToGridLengthConverter}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
<RowDefinition />
<RowDefinition Height="{Binding MessageHeight, Converter={x:Static pw:Converters.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 Margin="{TemplateBinding HeaderPadding}"
VerticalAlignment="{TemplateBinding VerticalHeaderAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalHeaderAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
Expand All @@ -28,10 +30,7 @@
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
Foreground="{TemplateBinding HeaderForeground}"
FontSize="{TemplateBinding HeaderFontSize}"
FontWeight="{TemplateBinding HeaderFontWeight}"
Margin="{TemplateBinding HeaderPadding}"
VerticalAlignment="{TemplateBinding VerticalHeaderAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalHeaderAlignment}" />
FontWeight="{TemplateBinding HeaderFontWeight}"/>
<ContentControl Grid.Column="1"
Focusable="False"
Content="{TemplateBinding ExtendControl}" />
Expand Down Expand Up @@ -77,27 +76,28 @@
MaxHeight="{Binding MaxMessageHeight, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding InternalHeaderHeight, Converter={x:Static pw:Converters.DoubleToGridLengthConverter}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding InternalHeaderWidth, Converter={x:Static pw:Converters.DoubleToGridLengthConverter}, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ContentControl x:Name="PART_HeaderControl"
Focusable="False"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
Foreground="{TemplateBinding HeaderForeground}"
Margin="{TemplateBinding HeaderPadding}"
VerticalAlignment="{TemplateBinding VerticalHeaderAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalHeaderAlignment}" />
<ContentControl Grid.Row="2"
Focusable="False"
Content="{TemplateBinding ExtendControl}" />
<Grid Margin="{TemplateBinding HeaderPadding}"
VerticalAlignment="{TemplateBinding VerticalHeaderAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalHeaderAlignment}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ContentControl x:Name="PART_HeaderControl"
Focusable="False"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
Foreground="{TemplateBinding HeaderForeground}" />
<ContentControl Grid.Row="1"
Focusable="False"
Content="{TemplateBinding ExtendControl}" />
</Grid>
<ContentPresenter x:Name="CpContent"
Grid.Column="1"
Grid.RowSpan="3"
Expand Down
50 changes: 18 additions & 32 deletions SourceCode/SharedResources/Panuon.WPF.UI/Controls/FormGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,6 @@ public object ExtendControl
#region Overrides
public override void OnApplyTemplate()
{


_headerControl = GetTemplateChild(HeaderContentControlTemplateName) as ContentControl;
_headerControl.SizeChanged += HeaderControl_SizeChanged;
}
Expand Down Expand Up @@ -383,12 +381,12 @@ private void FormGroup_CollectSize(object sender, FormGroupCollectSizeEventArgs
{
if (e.Orientation == Orientation.Horizontal)
{
var width = GetComputedWidth(false);
var width = GetComputedWidth();
e.Maximuim = Math.Max(e.Maximuim, width);
}
else
{
var height = GetComputedHeight(false);
var height = GetComputedHeight();
e.Maximuim = Math.Max(e.Maximuim, height);
}
}
Expand Down Expand Up @@ -423,29 +421,13 @@ private void DeteminingSize()
var size = 0d;
if (Orientation == Orientation.Horizontal)
{
size = GetComputedWidth(false);
var internalHeight = GetComputedHeight(true);
if (double.IsNaN(internalHeight))
{
FrameworkElementUtil.BindingProperty(this, InternalHeaderHeightProperty, this, ActualHeightProperty);
}
else
{
InternalHeaderHeight = internalHeight;
}
size = GetComputedWidth();
InternalHeaderHeight = double.NaN;
}
else
{
size = GetComputedHeight(false);
var internalWidth = GetComputedWidth(true);
if (double.IsNaN(internalWidth))
{
FrameworkElementUtil.BindingProperty(this, InternalHeaderWidthProperty, this, ActualWidthProperty);
}
else
{
InternalHeaderWidth = internalWidth;
}
size = GetComputedHeight();
InternalHeaderWidth = double.NaN;
}
var collectSizeEventArgs = new FormGroupCollectSizeEventArgs(Orientation, size);
if (!string.IsNullOrEmpty(GroupName))
Expand Down Expand Up @@ -475,26 +457,30 @@ private void DeteminingSize()
}
}

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

private double GetComputedHeight(bool allowNaN)
private double GetComputedHeight()
{
var size = GridLengthUtil.ComputeValue(RenderSize.Height, HeaderHeight);
if (double.IsNaN(size) && !allowNaN)
if (HeaderHeight.IsAuto)
{
_headerControl.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
return _headerControl.DesiredSize.Height;
}
return size;
else
{
return HeaderHeight.Value;
}
}
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,15 @@ private static void OnRegistChanged(DependencyObject d, DependencyPropertyChange
private static void ListBoxItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var listBoxItem = sender as ListBoxItem;
var listBox = FrameworkElementUtil.FindVisualParent<ListBox>(listBoxItem);
if(listBoxItem == null)
{
return;
}
var listBox = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
if (listBox == null)
{
return;
}
var removedArgs = new RoutedEventArgs(ListBoxHelper.ItemClickEvent, listBoxItem);
listBox.RaiseEvent(removedArgs);
if (removedArgs.Handled)
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.6")]
[assembly: AssemblyFileVersion("1.2.1.6")]
[assembly: AssemblyVersion("1.2.1.7")]
[assembly: AssemblyFileVersion("1.2.1.7")]

0 comments on commit ce01b3b

Please sign in to comment.