enhance: optimized ElementGroup

This commit is contained in:
NaBian committed 2022-01-19 22:56:50 +08:00
1 parent 483370f218
commit fda076b5e6
14 files changed
+330 -215

No files matched your search

@@ -587,6 +587,27 @@
<TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}" /> <TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}" />
</hc:SimplePanel> </hc:SimplePanel>
</ControlTemplate> </ControlTemplate>
<ItemsPanelTemplate x:Key="UniformHorizontalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="UniformVerticalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Columns="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="DockItemsPanelTemplate">
<DockPanel FocusVisualStyle="{x:Null}" LastChildFill="True" />
</ItemsPanelTemplate>
<LinearGradientBrush x:Key="ResizeGripperForeground" EndPoint="1,0.75" StartPoint="0,0.25"> <LinearGradientBrush x:Key="ResizeGripperForeground" EndPoint="1,0.75" StartPoint="0,0.25">
<GradientStop Color="#FFFFFF" Offset="0.3" /> <GradientStop Color="#FFFFFF" Offset="0.3" />
<GradientStop Color="#BBC5D7" Offset="0.75" /> <GradientStop Color="#BBC5D7" Offset="0.75" />
@@ -722,12 +743,6 @@
</DrawingGroup> </DrawingGroup>
</DrawingBrush.Drawing> </DrawingBrush.Drawing>
</DrawingBrush> </DrawingBrush>
<ItemsPanelTemplate x:Key="StepBarHorizontalItemsPanelTemplate">
<UniformGrid Rows="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StepBarVerticalItemsPanelTemplate">
<UniformGrid Columns="1" />
</ItemsPanelTemplate>
<ContextMenu x:Key="TabItemMenu" x:Shared="False"> <ContextMenu x:Key="TabItemMenu" x:Shared="False">
<MenuItem Command="interactivity:ControlCommands.Close" Header="{x:Static langs:Lang.Close}" /> <MenuItem Command="interactivity:ControlCommands.Close" Header="{x:Static langs:Lang.Close}" />
<MenuItem Command="interactivity:ControlCommands.CloseAll" Header="{x:Static langs:Lang.CloseAll}" /> <MenuItem Command="interactivity:ControlCommands.CloseAll" Header="{x:Static langs:Lang.CloseAll}" />
@@ -813,21 +828,6 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<ItemsPanelTemplate x:Key="WrapPanelHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapPanelVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackPanelHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackPanelVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Stretch" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="ComboBoxCapsuleItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1" />
</ItemsPanelTemplate>
<tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector" /> <tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector" />
<hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector" /> <hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector" />
<hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector" /> <hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector" />
@@ -2479,6 +2479,39 @@
</MultiTrigger> </MultiTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="ElementGroupBaseStyle" TargetType="hc:ElementGroup">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Layout" Value="Uniform" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource RegionBrush}" />
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource PrimaryBrush}" />
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Uniform" />
<Condition Property="Orientation" Value="Vertical" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack" />
<Condition Property="Orientation" Value="Horizontal" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack" />
<Condition Property="Orientation" Value="Vertical" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<Style x:Key="ProgressBarBaseStyle" TargetType="ProgressBar"> <Style x:Key="ProgressBarBaseStyle" TargetType="ProgressBar">
<Setter Property="hc:VisualElement.Text"> <Setter Property="hc:VisualElement.Text">
<Setter.Value> <Setter.Value>
@@ -10626,23 +10659,23 @@
<Setter Property="Focusable" Value="False" /> <Setter Property="Focusable" Value="False" />
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}" />
<Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="Dock" Value="Left"> <Trigger Property="Dock" Value="Left">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" />
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</Trigger> </Trigger>
<Trigger Property="Dock" Value="Bottom"> <Trigger Property="Dock" Value="Bottom">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}" />
<Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
</Trigger> </Trigger>
<Trigger Property="Dock" Value="Right"> <Trigger Property="Dock" Value="Right">
<Setter Property="FlowDirection" Value="RightToLeft" /> <Setter Property="FlowDirection" Value="RightToLeft" />
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" />
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
@@ -12137,7 +12170,6 @@
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
<hc:SimplePanel ClipToBounds="True"> <hc:SimplePanel ClipToBounds="True">
<StackPanel x:Name="PART_Panel" Orientation="Horizontal" /> <StackPanel x:Name="PART_Panel" Orientation="Horizontal" />
<!--<ItemsPresenter x:Name="PART_ItemsControl" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Left"/>-->
<hc:SimplePanel x:Name="GridTop" Opacity="0"> <hc:SimplePanel x:Name="GridTop" Opacity="0">
<Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}"> <Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4"> <Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
@@ -12472,6 +12504,12 @@
<Style BasedOn="{StaticResource DialogBaseStyle}" TargetType="hc:Dialog" /> <Style BasedOn="{StaticResource DialogBaseStyle}" TargetType="hc:Dialog" />
<Style BasedOn="{StaticResource DividerBaseStyle}" TargetType="hc:Divider" /> <Style BasedOn="{StaticResource DividerBaseStyle}" TargetType="hc:Divider" />
<Style BasedOn="{StaticResource DrawerBaseStyle}" TargetType="hc:Drawer" /> <Style BasedOn="{StaticResource DrawerBaseStyle}" TargetType="hc:Drawer" />
<Style BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup" />
<Style x:Key="ElementGroupSolid" BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup">
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource TitleBrush}" />
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource TitleBrush}" />
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource TextIconBrush}" />
</Style>
<Style BasedOn="{StaticResource EmptyBaseStyle}" TargetType="hc:Empty" /> <Style BasedOn="{StaticResource EmptyBaseStyle}" TargetType="hc:Empty" />
<Style BasedOn="{StaticResource ExpanderBaseStyle}" TargetType="Expander" /> <Style BasedOn="{StaticResource ExpanderBaseStyle}" TargetType="Expander" />
<Style BasedOn="{StaticResource FlowDocumentScrollViewerBaseStyle}" TargetType="FlowDocumentScrollViewer" /> <Style BasedOn="{StaticResource FlowDocumentScrollViewerBaseStyle}" TargetType="FlowDocumentScrollViewer" />
@@ -12616,16 +12654,16 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style> </Style>
<Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource WrapHorizontalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource WrapVerticalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="ListViewBaseStyle" TargetType="ListView"> <Style x:Key="ListViewBaseStyle" TargetType="ListView">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" /> <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
@@ -13052,7 +13090,7 @@
<Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Focusable" Value="False" /> <Setter Property="Focusable" Value="False" />
<Setter Property="ItemsPanel" Value="{StaticResource ComboBoxCapsuleItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ComboBox"> <ControlTemplate TargetType="ComboBox">
@@ -6,8 +6,20 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs" xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"> xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension">
<hc:TransitioningContentControl> <hc:TransitioningContentControl>
<StackPanel Margin="32" VerticalAlignment="Center"> <hc:UniformSpacingPanel Margin="32" VerticalAlignment="Center" Orientation="Vertical" Spacing="16">
<hc:ElementGroup Orientation="Horizontal"> <hc:ElementGroup Orientation="Horizontal" Layout="Stack">
<Button HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/>
<Button HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/>
<Button HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/>
<Button HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/>
</hc:ElementGroup>
<hc:ElementGroup Orientation="Horizontal" Width="500">
<ToggleButton HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.ToggleButton}}"/>
<Button HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/>
<ToggleButton HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.ToggleButton}}"/>
<Button HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/>
</hc:ElementGroup>
<hc:ElementGroup Orientation="Horizontal" Layout="Stack">
<Border Style="{StaticResource BorderRegion}" Padding="6,0"> <Border Style="{StaticResource BorderRegion}" Padding="6,0">
<Path Data="{StaticResource ClockGeometry}" Width="16" Height="16" Stretch="Uniform" Fill="{DynamicResource BorderBrush}"/> <Path Data="{StaticResource ClockGeometry}" Width="16" Height="16" Stretch="Uniform" Fill="{DynamicResource BorderBrush}"/>
</Border> </Border>
@@ -15,11 +27,20 @@
<Button Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/> <Button Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/>
<ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.ToggleButton}}"/> <ToggleButton Content="{ex:Lang Key={x:Static langs:LangKeys.ToggleButton}}"/>
</hc:ElementGroup> </hc:ElementGroup>
<hc:ElementGroup Margin="0,16,0,0"> <hc:ElementGroup>
<TextBox/> <hc:ElementGroup.ItemsPanel>
<Button HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}"/> <ItemsPanelTemplate>
<ToggleButton HorizontalAlignment="Stretch" Width="auto" Content="{ex:Lang Key={x:Static langs:LangKeys.ToggleButton}}"/> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</hc:ElementGroup.ItemsPanel>
<TextBox HorizontalAlignment="Stretch" DockPanel.Dock="Left"/>
<Button Grid.Column="1" Width="100" Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}" DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource ButtonPrimary}"/>
</hc:ElementGroup> </hc:ElementGroup>
</StackPanel> </hc:UniformSpacingPanel>
</hc:TransitioningContentControl> </hc:TransitioningContentControl>
</UserControl> </UserControl>
@@ -1,14 +1,38 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media;
using HandyControl.Data;
using HandyControl.Tools; using HandyControl.Tools;
namespace HandyControl.Controls namespace HandyControl.Controls
{ {
public class ElementGroup : SimpleStackPanel public class ElementGroup : ItemsControl
{ {
private static readonly Dictionary<Orientation, Dictionary<ChildLocation, CornerRadius>> CornerRadiusDict; private static readonly Dictionary<Orientation, Dictionary<ChildLocation, CornerRadius>> CornerRadiusDict;
public static readonly DependencyProperty OrientationProperty =
StackPanel.OrientationProperty.AddOwner(typeof(ElementGroup),
new FrameworkPropertyMetadata(ValueBoxes.HorizontalBox, FrameworkPropertyMetadataOptions.AffectsMeasure));
public Orientation Orientation
{
get => (Orientation) GetValue(OrientationProperty);
set => SetValue(OrientationProperty, ValueBoxes.OrientationBox(value));
}
public static readonly DependencyProperty LayoutProperty = DependencyProperty.Register(
"Layout", typeof(LinearLayout), typeof(ElementGroup),
new FrameworkPropertyMetadata(LinearLayout.Uniform, FrameworkPropertyMetadataOptions.AffectsMeasure));
public LinearLayout Layout
{
get => (LinearLayout) GetValue(LayoutProperty);
set => SetValue(LayoutProperty, value);
}
static ElementGroup() static ElementGroup()
{ {
var defaultCornerRadius = ResourceHelper.GetResourceInternal<CornerRadius>("DefaultCornerRadius"); var defaultCornerRadius = ResourceHelper.GetResourceInternal<CornerRadius>("DefaultCornerRadius");
@@ -40,47 +64,62 @@ namespace HandyControl.Controls
{ {
elementAdded.GotFocus += ElementAdded_GotFocus; elementAdded.GotFocus += ElementAdded_GotFocus;
elementAdded.LostFocus += ElementAdded_LostFocus; elementAdded.LostFocus += ElementAdded_LostFocus;
elementAdded.IsVisibleChanged += ElementAdded_IsVisibleChanged;
} }
if (visualRemoved is UIElement elementRemoved) if (visualRemoved is UIElement elementRemoved)
{ {
elementRemoved.GotFocus -= ElementAdded_GotFocus; elementRemoved.GotFocus -= ElementAdded_GotFocus;
elementRemoved.LostFocus -= ElementAdded_LostFocus; elementRemoved.LostFocus -= ElementAdded_LostFocus;
elementRemoved.IsVisibleChanged -= ElementAdded_IsVisibleChanged;
} }
}
var childrenCount = InternalChildren.Count; protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) => UpdateChildrenCornerRadius();
if (childrenCount == 0)
protected override void OnRender(DrawingContext drawingContext) => UpdateChildrenCornerRadius();
private void UpdateChildrenCornerRadius()
{
var visibleChildren = GetVisibleChildrenCount();
var count = visibleChildren.Count;
if (count == 0)
{ {
return; return;
} }
var orientation = Orientation; var orientation = Orientation;
if (childrenCount == 1) if (count == 1)
{ {
UpdateChildCornerRadius(InternalChildren[0], CornerRadiusDict[orientation][ChildLocation.Single]); UpdateChildCornerRadius(visibleChildren[0], CornerRadiusDict[orientation][ChildLocation.Single]);
} }
else else
{ {
UpdateChildCornerRadius(InternalChildren[0], CornerRadiusDict[orientation][ChildLocation.First]); UpdateChildCornerRadius(visibleChildren[0], CornerRadiusDict[orientation][ChildLocation.First]);
var childMargin = orientation == Orientation.Horizontal var childMargin = orientation == Orientation.Horizontal
? new Thickness(-1, 0, 0, 0) ? new Thickness(-1, 0, 0, 0)
: new Thickness(0, -1, 0, 0); : new Thickness(0, -1, 0, 0);
for (var childIndex = 1; childIndex < childrenCount; childIndex++) for (var childIndex = 1; childIndex < count; childIndex++)
{ {
var child = InternalChildren[childIndex]; var child = visibleChildren[childIndex];
child.SetCurrentValue(MarginProperty, childMargin); child.SetCurrentValue(MarginProperty, childMargin);
UpdateChildCornerRadius(child, CornerRadiusDict[orientation][ChildLocation.Middle]); UpdateChildCornerRadius(child, CornerRadiusDict[orientation][ChildLocation.Middle]);
} }
var lastChild = InternalChildren[childrenCount - 1]; var lastChild = visibleChildren[count - 1];
lastChild.SetCurrentValue(MarginProperty, childMargin); lastChild.SetCurrentValue(MarginProperty, childMargin);
UpdateChildCornerRadius(lastChild, CornerRadiusDict[orientation][ChildLocation.Last]); UpdateChildCornerRadius(lastChild, CornerRadiusDict[orientation][ChildLocation.Last]);
} }
} }
private List<UIElement> GetVisibleChildrenCount()
{
return Items.OfType<UIElement>().Where(element => element.Visibility == Visibility.Visible).ToList();
}
private static void UpdateChildCornerRadius(DependencyObject child, CornerRadius cornerRadius) private static void UpdateChildCornerRadius(DependencyObject child, CornerRadius cornerRadius)
{ {
if (child is Border border) if (child is Border border)
@@ -93,21 +132,15 @@ namespace HandyControl.Controls
} }
} }
private void ElementAdded_LostFocus(object sender, RoutedEventArgs e) private void ElementAdded_LostFocus(object sender, RoutedEventArgs e) => ResetElementZIndex(e.OriginalSource);
{
if (sender is UIElement element)
{
SetZIndex(element, 0);
}
}
private void ElementAdded_GotFocus(object sender, RoutedEventArgs e) private void ElementAdded_GotFocus(object sender, RoutedEventArgs e) => MaximizeElementZIndex(e.OriginalSource);
{
if (sender is UIElement element) private static void ResetElementZIndex(object element) => Panel.SetZIndex((UIElement) element, 0);
{
SetZIndex(element, int.MaxValue); private static void MaximizeElementZIndex(object element) => Panel.SetZIndex((UIElement) element, int.MaxValue);
}
} private void ElementAdded_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) => UpdateChildrenCornerRadius();
private enum ChildLocation private enum ChildLocation
{ {
@@ -429,12 +429,21 @@
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\AutoCompleteTextBoxBaseStyle.xaml"> <None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\AutoCompleteTextBoxBaseStyle.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ItemsPanelTemplate.xaml">
<SubType>Designer</SubType>
</None>
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ElementGroupBaseStyle.xaml">
<SubType>Designer</SubType>
</None>
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ListViewBaseStyle.xaml"> <None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ListViewBaseStyle.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\DataGridBaseStyle.xaml"> <None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\DataGridBaseStyle.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\ElementGroup.xaml">
<SubType>Designer</SubType>
</None>
<None Include="$(MSBuildThisFileDirectory)Themes\XamlCombine.exe" /> <None Include="$(MSBuildThisFileDirectory)Themes\XamlCombine.exe" />
<Page Include="$(MSBuildThisFileDirectory)Themes\Basic\Colors\Colors.xaml"> <Page Include="$(MSBuildThisFileDirectory)Themes\Basic\Colors\Colors.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -0,0 +1,39 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="clr-namespace:HandyControl.Controls">
<Style x:Key="ElementGroupBaseStyle" TargetType="hc:ElementGroup">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Layout" Value="Uniform"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource RegionBrush}"/>
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource PrimaryBrush}"/>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Uniform"/>
<Condition Property="Orientation" Value="Vertical"/>
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack"/>
<Condition Property="Orientation" Value="Horizontal"/>
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack"/>
<Condition Property="Orientation" Value="Vertical"/>
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}"/>
</MultiTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
@@ -0,0 +1,32 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ItemsPanelTemplate x:Key="UniformHorizontalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1"/>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="UniformVerticalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Columns="1"/>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal"/>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}"/>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="DockItemsPanelTemplate">
<DockPanel FocusVisualStyle="{x:Null}" LastChildFill="True"/>
</ItemsPanelTemplate>
</ResourceDictionary>
@@ -66,14 +66,6 @@
</Setter> </Setter>
</Style> </Style>
<ItemsPanelTemplate x:Key="StepBarHorizontalItemsPanelTemplate">
<UniformGrid Rows="1"/>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StepBarVerticalItemsPanelTemplate">
<UniformGrid Columns="1"/>
</ItemsPanelTemplate>
<ControlTemplate x:Key="StepBarHorizontalTopControlTemplate" TargetType="hc:StepBar"> <ControlTemplate x:Key="StepBarHorizontalTopControlTemplate" TargetType="hc:StepBar">
<hc:SimplePanel> <hc:SimplePanel>
<ProgressBar HorizontalAlignment="Center" Name="PART_ProgressBarBack" VerticalAlignment="Top" Margin="0,10,0,0" Style="{StaticResource ProgressBarFlat}" Background="{DynamicResource ThirdlyTextBrush}"/> <ProgressBar HorizontalAlignment="Center" Name="PART_ProgressBarBack" VerticalAlignment="Top" Margin="0,10,0,0" Style="{StaticResource ProgressBarFlat}" Background="{DynamicResource ThirdlyTextBrush}"/>
@@ -105,23 +97,23 @@
<Setter Property="Focusable" Value="False"/> <Setter Property="Focusable" Value="False"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}"/> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}"/>
<Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}"/> <Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}"/>
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
<Style.Triggers> <Style.Triggers>
<Trigger Property="Dock" Value="Left"> <Trigger Property="Dock" Value="Left">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}"/> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}"/>
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}"/> <Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}"/>
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}"/>
</Trigger> </Trigger>
<Trigger Property="Dock" Value="Bottom"> <Trigger Property="Dock" Value="Bottom">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}"/> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}"/>
<Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}"/> <Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}"/>
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
</Trigger> </Trigger>
<Trigger Property="Dock" Value="Right"> <Trigger Property="Dock" Value="Right">
<Setter Property="FlowDirection" Value="RightToLeft"/> <Setter Property="FlowDirection" Value="RightToLeft"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}"/> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}"/>
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}"/> <Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}"/>
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}"/>
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
@@ -68,7 +68,6 @@
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
<hc:SimplePanel ClipToBounds="True"> <hc:SimplePanel ClipToBounds="True">
<StackPanel x:Name="PART_Panel" Orientation="Horizontal"/> <StackPanel x:Name="PART_Panel" Orientation="Horizontal"/>
<!--<ItemsPresenter x:Name="PART_ItemsControl" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Left"/>-->
<hc:SimplePanel x:Name="GridTop" Opacity="0"> <hc:SimplePanel x:Name="GridTop" Opacity="0">
<Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}"> <Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4"> <Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
@@ -88,89 +87,4 @@
</Setter> </Setter>
</Style> </Style>
<!--<Style x:Key="CarouselListBoxItemStyle" BasedOn="{StaticResource ListBoxItemCustom}" TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/>
</Style>
<ItemsPanelTemplate x:Key="CarouselListBoxItemPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" HorizontalAlignment="Left"/>
</ItemsPanelTemplate>
<Style x:Key="CarouselListBox" BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource CarouselListBoxItemPanelTemplate}"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource CarouselListBoxItemStyle}"/>
</Style>
<Style x:Key="CarouselPateButton" BasedOn="{StaticResource BaseStyle}" TargetType="RadioButton">
<Setter Property="Margin" Value="5,0"/>
<Setter Property="Width" Value="10"/>
<Setter Property="Height" Value="10"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border CornerRadius="5" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value=".9"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value=".6"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="hc:Carousel" BasedOn="{StaticResource CarouselListBox}">
<Setter Property="PageButtonStyle" Value="{StaticResource CarouselPateButton}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Carousel">
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.MouseEnter">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="GridTop" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="FrameworkElement.MouseLeave">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="GridTop" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
<hc:SimplePanel ClipToBounds="True">
<ItemsPresenter x:Name="PART_ItemsControl" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Left"/>
<hc:SimplePanel x:Name="GridTop" Opacity="0">
<Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
<Path Margin="16" Fill="White" Style="{StaticResource LeftPathStyle}"/>
</Border>
</Button>
<Button Command="interactivity:ControlCommands.Next" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,30,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
<Path Margin="16" Fill="White" Style="{StaticResource RightPathStyle}"/>
</Border>
</Button>
</hc:SimplePanel>
<StackPanel Name="PART_PanelPage" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,20"/>
</hc:SimplePanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>-->
</ResourceDictionary> </ResourceDictionary>
@@ -0,0 +1,13 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="clr-namespace:HandyControl.Controls">
<Style BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup"/>
<Style x:Key="ElementGroupSolid" BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup">
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource TitleBrush}"/>
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource TitleBrush}"/>
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource TextIconBrush}"/>
</Style>
</ResourceDictionary>
@@ -36,36 +36,20 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style> </Style>
<ItemsPanelTemplate x:Key="WrapPanelHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</ItemsPanelTemplate>
<Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelHorizontalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource WrapHorizontalItemsPanelTemplate}"/>
</Style> </Style>
<ItemsPanelTemplate x:Key="WrapPanelVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</ItemsPanelTemplate>
<Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelVerticalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource WrapVerticalItemsPanelTemplate}"/>
</Style> </Style>
<ItemsPanelTemplate x:Key="StackPanelHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal"/>
</ItemsPanelTemplate>
<Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelHorizontalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}"/>
</Style> </Style>
<ItemsPanelTemplate x:Key="StackPanelVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
<Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelVerticalItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}"/>
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
@@ -67,10 +67,6 @@
<Setter Property="hc:BorderElement.CornerRadius" Value="0,0,4,4"/> <Setter Property="hc:BorderElement.CornerRadius" Value="0,0,4,4"/>
</Style> </Style>
<ItemsPanelTemplate x:Key="ComboBoxCapsuleItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1"/>
</ItemsPanelTemplate>
<tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector"/> <tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector"/>
<Style x:Key="ComboBoxCapsule" BasedOn="{x:Null}" TargetType="ComboBox"> <Style x:Key="ComboBoxCapsule" BasedOn="{x:Null}" TargetType="ComboBox">
@@ -78,7 +74,7 @@
<Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Focusable" Value="False"/> <Setter Property="Focusable" Value="False"/>
<Setter Property="ItemsPanel" Value="{StaticResource ComboBoxCapsuleItemsPanelTemplate}"/> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ComboBox"> <ControlTemplate TargetType="ComboBox">
@@ -587,6 +587,27 @@
<TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}" /> <TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}" />
</hc:SimplePanel> </hc:SimplePanel>
</ControlTemplate> </ControlTemplate>
<ItemsPanelTemplate x:Key="UniformHorizontalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="UniformVerticalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Columns="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="DockItemsPanelTemplate">
<DockPanel FocusVisualStyle="{x:Null}" LastChildFill="True" />
</ItemsPanelTemplate>
<LinearGradientBrush x:Key="ResizeGripperForeground" EndPoint="1,0.75" StartPoint="0,0.25"> <LinearGradientBrush x:Key="ResizeGripperForeground" EndPoint="1,0.75" StartPoint="0,0.25">
<GradientStop Color="#FFFFFF" Offset="0.3" /> <GradientStop Color="#FFFFFF" Offset="0.3" />
<GradientStop Color="#BBC5D7" Offset="0.75" /> <GradientStop Color="#BBC5D7" Offset="0.75" />
@@ -722,12 +743,6 @@
</DrawingGroup> </DrawingGroup>
</DrawingBrush.Drawing> </DrawingBrush.Drawing>
</DrawingBrush> </DrawingBrush>
<ItemsPanelTemplate x:Key="StepBarHorizontalItemsPanelTemplate">
<UniformGrid Rows="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StepBarVerticalItemsPanelTemplate">
<UniformGrid Columns="1" />
</ItemsPanelTemplate>
<ContextMenu x:Key="TabItemMenu" x:Shared="False"> <ContextMenu x:Key="TabItemMenu" x:Shared="False">
<MenuItem Command="interactivity:ControlCommands.Close" Header="{x:Static langs:Lang.Close}" /> <MenuItem Command="interactivity:ControlCommands.Close" Header="{x:Static langs:Lang.Close}" />
<MenuItem Command="interactivity:ControlCommands.CloseAll" Header="{x:Static langs:Lang.CloseAll}" /> <MenuItem Command="interactivity:ControlCommands.CloseAll" Header="{x:Static langs:Lang.CloseAll}" />
@@ -813,21 +828,6 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<ItemsPanelTemplate x:Key="WrapPanelHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapPanelVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackPanelHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackPanelVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Stretch" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="ComboBoxCapsuleItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1" />
</ItemsPanelTemplate>
<tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector" /> <tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector" />
<hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector" /> <hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector" />
<hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector" /> <hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector" />
@@ -2479,6 +2479,39 @@
</MultiTrigger> </MultiTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="ElementGroupBaseStyle" TargetType="hc:ElementGroup">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Layout" Value="Uniform" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource RegionBrush}" />
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource PrimaryBrush}" />
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Uniform" />
<Condition Property="Orientation" Value="Vertical" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack" />
<Condition Property="Orientation" Value="Horizontal" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack" />
<Condition Property="Orientation" Value="Vertical" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<Style x:Key="ProgressBarBaseStyle" TargetType="ProgressBar"> <Style x:Key="ProgressBarBaseStyle" TargetType="ProgressBar">
<Setter Property="hc:VisualElement.Text"> <Setter Property="hc:VisualElement.Text">
<Setter.Value> <Setter.Value>
@@ -10744,23 +10777,23 @@
<Setter Property="Focusable" Value="False" /> <Setter Property="Focusable" Value="False" />
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}" />
<Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="Dock" Value="Left"> <Trigger Property="Dock" Value="Left">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" />
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</Trigger> </Trigger>
<Trigger Property="Dock" Value="Bottom"> <Trigger Property="Dock" Value="Bottom">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}" />
<Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
</Trigger> </Trigger>
<Trigger Property="Dock" Value="Right"> <Trigger Property="Dock" Value="Right">
<Setter Property="FlowDirection" Value="RightToLeft" /> <Setter Property="FlowDirection" Value="RightToLeft" />
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" />
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" /> <Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
@@ -12270,7 +12303,6 @@
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
<hc:SimplePanel ClipToBounds="True"> <hc:SimplePanel ClipToBounds="True">
<StackPanel x:Name="PART_Panel" Orientation="Horizontal" /> <StackPanel x:Name="PART_Panel" Orientation="Horizontal" />
<!--<ItemsPresenter x:Name="PART_ItemsControl" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Left"/>-->
<hc:SimplePanel x:Name="GridTop" Opacity="0"> <hc:SimplePanel x:Name="GridTop" Opacity="0">
<Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}"> <Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4"> <Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
@@ -12614,6 +12646,12 @@
<Style BasedOn="{StaticResource DialogBaseStyle}" TargetType="hc:Dialog" /> <Style BasedOn="{StaticResource DialogBaseStyle}" TargetType="hc:Dialog" />
<Style BasedOn="{StaticResource DividerBaseStyle}" TargetType="hc:Divider" /> <Style BasedOn="{StaticResource DividerBaseStyle}" TargetType="hc:Divider" />
<Style BasedOn="{StaticResource DrawerBaseStyle}" TargetType="hc:Drawer" /> <Style BasedOn="{StaticResource DrawerBaseStyle}" TargetType="hc:Drawer" />
<Style BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup" />
<Style x:Key="ElementGroupSolid" BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup">
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource TitleBrush}" />
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource TitleBrush}" />
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource TextIconBrush}" />
</Style>
<Style BasedOn="{StaticResource EmptyBaseStyle}" TargetType="hc:Empty" /> <Style BasedOn="{StaticResource EmptyBaseStyle}" TargetType="hc:Empty" />
<Style BasedOn="{StaticResource ExpanderBaseStyle}" TargetType="Expander" /> <Style BasedOn="{StaticResource ExpanderBaseStyle}" TargetType="Expander" />
<Style BasedOn="{StaticResource FlowDocumentScrollViewerBaseStyle}" TargetType="FlowDocumentScrollViewer" /> <Style BasedOn="{StaticResource FlowDocumentScrollViewerBaseStyle}" TargetType="FlowDocumentScrollViewer" />
@@ -12758,16 +12796,16 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style> </Style>
<Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource WrapHorizontalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource WrapVerticalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelHorizontalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox"> <Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelVerticalItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}" />
</Style> </Style>
<Style x:Key="ListViewBaseStyle" TargetType="ListView"> <Style x:Key="ListViewBaseStyle" TargetType="ListView">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" /> <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
@@ -13203,7 +13241,7 @@
<Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Focusable" Value="False" /> <Setter Property="Focusable" Value="False" />
<Setter Property="ItemsPanel" Value="{StaticResource ComboBoxCapsuleItemsPanelTemplate}" /> <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ComboBox"> <ControlTemplate TargetType="ComboBox">
@@ -37,9 +37,11 @@ Styles\Base\RepeatButtonBaseStyle.xaml
Styles\Base\ToggleBlockBaseStyle.xaml Styles\Base\ToggleBlockBaseStyle.xaml
Styles\Base\GroupBoxBaseStyle.xaml Styles\Base\GroupBoxBaseStyle.xaml
Styles\Base\ButtonGroupBaseStyle.xaml Styles\Base\ButtonGroupBaseStyle.xaml
Styles\Base\ElementGroupBaseStyle.xaml
Styles\Base\ProgressBarBaseStyle.xaml Styles\Base\ProgressBarBaseStyle.xaml
Styles\Base\CheckBoxBaseStyle.xaml Styles\Base\CheckBoxBaseStyle.xaml
Styles\Base\RadioButtonBaseStyle.xaml Styles\Base\RadioButtonBaseStyle.xaml
Styles\Base\ItemsPanelTemplate.xaml
# -------------------------------------- # --------------------------------------
Styles\Button.xaml Styles\Button.xaml
Styles\TextBlock.xaml Styles\TextBlock.xaml
@@ -138,6 +140,7 @@ Styles\DateTimePicker.xaml
Styles\Dialog.xaml Styles\Dialog.xaml
Styles\Divider.xaml Styles\Divider.xaml
Styles\Drawer.xaml Styles\Drawer.xaml
Styles\ElementGroup.xaml
Styles\Empty.xaml Styles\Empty.xaml
Styles\Expander.xaml Styles\Expander.xaml
Styles\FlipClock.xaml Styles\FlipClock.xaml
@@ -37,9 +37,11 @@ Styles\Base\RepeatButtonBaseStyle.xaml
Styles\Base\ToggleBlockBaseStyle.xaml Styles\Base\ToggleBlockBaseStyle.xaml
Styles\Base\GroupBoxBaseStyle.xaml Styles\Base\GroupBoxBaseStyle.xaml
Styles\Base\ButtonGroupBaseStyle.xaml Styles\Base\ButtonGroupBaseStyle.xaml
Styles\Base\ElementGroupBaseStyle.xaml
Styles\Base\ProgressBarBaseStyle.xaml Styles\Base\ProgressBarBaseStyle.xaml
Styles\Base\CheckBoxBaseStyle.xaml Styles\Base\CheckBoxBaseStyle.xaml
Styles\Base\RadioButtonBaseStyle.xaml Styles\Base\RadioButtonBaseStyle.xaml
Styles\Base\ItemsPanelTemplate.xaml
# -------------------------------------- # --------------------------------------
Styles\Button.xaml Styles\Button.xaml
Styles\TextBlock.xaml Styles\TextBlock.xaml
@@ -138,6 +140,7 @@ Styles\DateTimePicker.xaml
Styles\Dialog.xaml Styles\Dialog.xaml
Styles\Divider.xaml Styles\Divider.xaml
Styles\Drawer.xaml Styles\Drawer.xaml
Styles\ElementGroup.xaml
Styles\Empty.xaml Styles\Empty.xaml
Styles\Expander.xaml Styles\Expander.xaml
Styles\FlipClock.xaml Styles\FlipClock.xaml