diff --git a/demo/Ursa.Demo/Pages/FormDemo.axaml b/demo/Ursa.Demo/Pages/FormDemo.axaml
index 5d63392..a6752e5 100644
--- a/demo/Ursa.Demo/Pages/FormDemo.axaml
+++ b/demo/Ursa.Demo/Pages/FormDemo.axaml
@@ -13,59 +13,42 @@
x:DataType="vm:FormDemoViewModel"
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/Ursa.Themes.Semi/Controls/Form.axaml b/src/Ursa.Themes.Semi/Controls/Form.axaml
index d6f8b64..6b424d1 100644
--- a/src/Ursa.Themes.Semi/Controls/Form.axaml
+++ b/src/Ursa.Themes.Semi/Controls/Form.axaml
@@ -1,24 +1,30 @@
+ xmlns:u="https://irihi.tech/ursa"
+ xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters">
-
-
+
+
-
+
-
+
@@ -32,15 +38,17 @@
Height="1"
Margin="0,8"
HorizontalAlignment="Stretch"
- IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Header, Converter={x:Static ObjectConverters.IsNotNull}}"
- Fill="{DynamicResource SemiColorBorder}" />
-
+ Fill="{DynamicResource SemiColorBorder}"
+ IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Header, Converter={x:Static ObjectConverters.IsNotNull}}" />
+
-
+
@@ -50,13 +58,19 @@
Margin="0,0,0,4"
HorizontalAlignment="{TemplateBinding LabelAlignment}"
Orientation="Horizontal">
-
+
-
+
@@ -65,7 +79,8 @@
-
+
-
+
@@ -95,9 +119,10 @@
-
+
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Converters/FormContentHeightToAlignmentConverter.cs b/src/Ursa.Themes.Semi/Converters/FormContentHeightToAlignmentConverter.cs
new file mode 100644
index 0000000..30db804
--- /dev/null
+++ b/src/Ursa.Themes.Semi/Converters/FormContentHeightToAlignmentConverter.cs
@@ -0,0 +1,36 @@
+using System.Globalization;
+using Avalonia.Controls;
+using Avalonia.Data.Converters;
+using Avalonia.Layout;
+
+namespace Ursa.Themes.Semi.Converters;
+
+public class FormContentHeightToAlignmentConverter: IValueConverter
+{
+ public static FormContentHeightToAlignmentConverter Instance = new(32);
+ public double Threshold { get; set; }
+
+ public FormContentHeightToAlignmentConverter()
+ {
+ Threshold = 32;
+ }
+
+ // ReSharper disable once ConvertToPrimaryConstructor
+ // Justification: need to keep the default constructor for XAML
+ public FormContentHeightToAlignmentConverter(double threshold)
+ {
+ Threshold = threshold;
+ }
+
+
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if(value is not double d) return VerticalAlignment.Center;
+ return d > Threshold ? VerticalAlignment.Top : VerticalAlignment.Center;
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Converters/FormContentHeightToMarginConverter.cs b/src/Ursa.Themes.Semi/Converters/FormContentHeightToMarginConverter.cs
new file mode 100644
index 0000000..43be772
--- /dev/null
+++ b/src/Ursa.Themes.Semi/Converters/FormContentHeightToMarginConverter.cs
@@ -0,0 +1,34 @@
+using System.Globalization;
+using Avalonia;
+using Avalonia.Data.Converters;
+
+namespace Ursa.Themes.Semi.Converters;
+
+public class FormContentHeightToMarginConverter: IValueConverter
+{
+ public static FormContentHeightToMarginConverter Instance = new();
+ public double Threshold { get; set; }
+
+ public FormContentHeightToMarginConverter()
+ {
+ Threshold = 32;
+ }
+
+ // ReSharper disable once ConvertToPrimaryConstructor
+ // Justification: need to keep the default constructor for XAML
+ public FormContentHeightToMarginConverter(double threshold)
+ {
+ Threshold = threshold;
+ }
+
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if(value is not double d) return new Thickness(0);
+ return d > Threshold ? new Thickness(0, 8, 8, 0) : new Thickness(0, 0, 8, 0);
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file