diff --git a/EleCho.WpfSuite/Panels/FlexPanel.cs b/EleCho.WpfSuite/Panels/FlexPanel.cs
index 67665bc..29cc8ec 100644
--- a/EleCho.WpfSuite/Panels/FlexPanel.cs
+++ b/EleCho.WpfSuite/Panels/FlexPanel.cs
@@ -91,7 +91,7 @@ public double CrossSpacing
public static readonly DependencyProperty ItemsAlignmentProperty =
DependencyProperty.Register(nameof(ItemsAlignment), typeof(FlexItemsAlignment), typeof(FlexPanel),
- new FrameworkPropertyMetadata(default(FlexItemsAlignment), FrameworkPropertyMetadataOptions.AffectsMeasure));
+ new FrameworkPropertyMetadata(FlexItemsAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsMeasure));
public static readonly DependencyProperty UniformGrowProperty =
DependencyProperty.Register(nameof(UniformGrow), typeof(double), typeof(FlexPanel),
diff --git a/EleCho.WpfSuite/Panels/StackPanel.cs b/EleCho.WpfSuite/Panels/StackPanel.cs
index 872beb8..51c0e1e 100644
--- a/EleCho.WpfSuite/Panels/StackPanel.cs
+++ b/EleCho.WpfSuite/Panels/StackPanel.cs
@@ -34,7 +34,9 @@ protected override Size MeasureOverride(Size availableSize)
var childDesiredSize = child.DesiredSize;
panelDesiredSize.Height += childDesiredSize.Height;
- panelDesiredSize.Height += spacing;
+
+ if (child.Visibility != Visibility.Collapsed)
+ panelDesiredSize.Height += spacing;
if (childDesiredSize.Width > panelDesiredSize.Width)
panelDesiredSize.Width = childDesiredSize.Width;
@@ -54,7 +56,9 @@ protected override Size MeasureOverride(Size availableSize)
var childDesiredSize = child.DesiredSize;
panelDesiredSize.Width += childDesiredSize.Width;
- panelDesiredSize.Width += spacing;
+
+ if (child.Visibility != Visibility.Collapsed)
+ panelDesiredSize.Width += spacing;
if (childDesiredSize.Height > panelDesiredSize.Height)
panelDesiredSize.Height = childDesiredSize.Height;
@@ -83,7 +87,9 @@ protected override Size ArrangeOverride(Size finalSize)
child.Arrange(new Rect(0, offset, finalSize.Width, childDesiredSize.Height));
offset += childDesiredSize.Height;
- offset += spacing;
+
+ if (child.Visibility != Visibility.Collapsed)
+ offset += spacing;
}
}
else
@@ -95,7 +101,8 @@ protected override Size ArrangeOverride(Size finalSize)
child.Arrange(new Rect(offset, 0, childDesiredSize.Width, finalSize.Height));
offset += childDesiredSize.Width;
- offset += spacing;
+ if (child.Visibility != Visibility.Collapsed)
+ offset += spacing;
}
}
diff --git a/EleCho.WpfSuite/Panels/WrapPanel.cs b/EleCho.WpfSuite/Panels/WrapPanel.cs
index 49236e7..d6c552a 100644
--- a/EleCho.WpfSuite/Panels/WrapPanel.cs
+++ b/EleCho.WpfSuite/Panels/WrapPanel.cs
@@ -70,7 +70,9 @@ protected override Size MeasureOverride(Size availableSize)
var childHeight = childHeightGetter.Invoke(childDesiredSize);
offsetX += childWidth;
- offsetX += horizontalSpacing;
+
+ if (child.Visibility != Visibility.Collapsed)
+ offsetX += horizontalSpacing;
if (offsetX > availableSize.Width)
{
@@ -113,11 +115,13 @@ protected override Size MeasureOverride(Size availableSize)
var childHeight = childHeightGetter.Invoke(childDesiredSize);
offsetY += childHeight;
- offsetY += verticalSpacing;
+
+ if (child.Visibility != Visibility.Collapsed)
+ offsetY += verticalSpacing;
if (offsetY > availableSize.Height)
{
- currentLineLength = offsetY -horizontalSpacing - childHeight - verticalSpacing;
+ currentLineLength = offsetY - horizontalSpacing - childHeight - verticalSpacing;
if (currentLineLength > maxLineLength)
maxLineLength = currentLineLength;
@@ -171,7 +175,9 @@ protected override Size ArrangeOverride(Size finalSize)
var childHeight = childHeightGetter.Invoke(childDesiredSize);
tempOffset += childWidth;
- tempOffset += horizontalSpacing;
+
+ if (child.Visibility != Visibility.Collapsed)
+ tempOffset += horizontalSpacing;
if (tempOffset - horizontalSpacing > finalSize.Width)
{
@@ -224,7 +230,9 @@ protected override Size ArrangeOverride(Size finalSize)
var childHeight = childHeightGetter.Invoke(childDesiredSize);
tempOffset += childHeight;
- tempOffset += verticalSpacing;
+
+ if (child.Visibility != Visibility.Collapsed)
+ tempOffset += verticalSpacing;
if (tempOffset - verticalSpacing > finalSize.Height)
{
@@ -293,7 +301,9 @@ static void ArrangeLineHorizontal(
lineChild.Arrange(new Rect(currentLineOffsetX + lineChildOffset, currentLineOffsetY, lineChildWidth, currentLineSize));
lineChildOffset += lineChildWidth;
- lineChildOffset += spacing;
+
+ if (lineChild.Visibility != Visibility.Collapsed)
+ lineChildOffset += spacing;
}
}
@@ -320,7 +330,9 @@ static void ArrangeLineVertical(
lineChild.Arrange(new Rect(currentLineOffsetX, currentLineOffsetY + lineChildOffset, currentLineSize, lineChildHeight));
lineChildOffset += lineChildHeight;
- lineChildOffset += spacing;
+
+ if (lineChild.Visibility != Visibility.Collapsed)
+ lineChildOffset += spacing;
}
}
}
diff --git a/WpfTest/MainWindow.xaml b/WpfTest/MainWindow.xaml
index 760f973..102f65d 100644
--- a/WpfTest/MainWindow.xaml
+++ b/WpfTest/MainWindow.xaml
@@ -5,10 +5,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfTest"
xmlns:ws="https://github.com/OrgEleCho/EleCho.WpfSuite"
+ xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
- Title="MainWindow" Height="450" Width="800"
+ Title="MainWindow" Height="550" Width="800"
+ Loaded="Window_Loaded"
d:DataContext="{d:DesignInstance Type=local:MainWindow}">
@@ -16,8 +18,10 @@
-
@@ -31,6 +35,11 @@
+ NavigationUIVisibility="Hidden"
+ Navigated="AppFrame_Navigated">
+
+
+
+
diff --git a/WpfTest/MainWindow.xaml.cs b/WpfTest/MainWindow.xaml.cs
index 3dbf623..8ec50a0 100644
--- a/WpfTest/MainWindow.xaml.cs
+++ b/WpfTest/MainWindow.xaml.cs
@@ -6,6 +6,7 @@
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
+using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
@@ -41,18 +42,23 @@ public MainWindow()
},
new NavigationItem()
{
- Title = "Temp test",
+ Title = "TextBox test",
Description = "",
- PageType = typeof(TempPage)
+ PageType = typeof(TextBoxTestPage)
},
new NavigationItem()
{
- Title = "TextBox test",
+ Title = "Temp test",
Description = "",
- PageType = typeof(TextBoxTestPage)
+ PageType = typeof(TempPage)
},
};
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ AppNavigations.SelectedItem = NavigationItems.FirstOrDefault();
+ }
+
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is not ListBox listBox ||
@@ -62,5 +68,21 @@ private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e
var page = Activator.CreateInstance(navigationItem.PageType);
AppFrame.Navigate(page);
}
+
+ private void AppFrame_Navigated(object sender, NavigationEventArgs e)
+ {
+ DoubleAnimation doubleAnimation = new DoubleAnimation()
+ {
+ From = 10,
+ To = 0,
+ Duration = new Duration(TimeSpan.FromMilliseconds(200)),
+ EasingFunction = new CircleEase()
+ {
+ EasingMode = EasingMode.EaseOut
+ }
+ };
+
+ AppFrame.RenderTransform.BeginAnimation(TranslateTransform.YProperty, doubleAnimation);
+ }
}
}
\ No newline at end of file
diff --git a/WpfTest/Tests/CollectionTestPage.xaml b/WpfTest/Tests/CollectionTestPage.xaml
index f2cc037..924cc9d 100644
--- a/WpfTest/Tests/CollectionTestPage.xaml
+++ b/WpfTest/Tests/CollectionTestPage.xaml
@@ -1,12 +1,13 @@
@@ -17,17 +18,92 @@
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/WpfTest/Tests/TempPage.xaml b/WpfTest/Tests/TempPage.xaml
index 430d56f..fa0d351 100644
--- a/WpfTest/Tests/TempPage.xaml
+++ b/WpfTest/Tests/TempPage.xaml
@@ -15,7 +15,7 @@
-
diff --git a/WpfTest/WpfTest.csproj b/WpfTest/WpfTest.csproj
index 8c8df1c..960c66e 100644
--- a/WpfTest/WpfTest.csproj
+++ b/WpfTest/WpfTest.csproj
@@ -15,6 +15,7 @@
+