feat: improve demo, add dynamic resource.

This commit is contained in:
rabbitism
2024-02-18 17:30:30 +08:00
parent 66835a8efa
commit a8d1073f75
7 changed files with 56 additions and 43 deletions

View File

@@ -22,12 +22,12 @@
<Setter Property="Template">
<ControlTemplate TargetType="u:FormGroup">
<StackPanel>
<ContentPresenter Content="{TemplateBinding Header}" FontWeight="Bold" />
<ContentPresenter Content="{TemplateBinding Header}" FontWeight="Bold" FontSize="18" />
<Rectangle
Height="1"
Margin="0,8"
HorizontalAlignment="Stretch"
Fill="LightGray" />
Fill="{DynamicResource FormGroupBorderBrush}" />
<ItemsPresenter ItemsPanel="{TemplateBinding ItemsPanel}" />
</StackPanel>
</ControlTemplate>

View File

@@ -0,0 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<SolidColorBrush x:Key="FormGroupBorderBrush" Color="White" Opacity="0.08"></SolidColorBrush>
</ResourceDictionary>

View File

@@ -7,6 +7,7 @@
<MergeResourceInclude Source="Dialog.axaml" />
<MergeResourceInclude Source="Divider.axaml" />
<MergeResourceInclude Source="DualBadge.axaml" />
<MergeResourceInclude Source="Form.axaml" />
<MergeResourceInclude Source="IPv4Box.axaml" />
<MergeResourceInclude Source="KeyGestureInput.axaml" />
<MergeResourceInclude Source="Loading.axaml" />

View File

@@ -0,0 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<SolidColorBrush x:Key="FormGroupBorderBrush" Color="#FF1C1F23" Opacity="0.08"></SolidColorBrush>
</ResourceDictionary>

View File

@@ -7,6 +7,7 @@
<MergeResourceInclude Source="Dialog.axaml" />
<MergeResourceInclude Source="Divider.axaml" />
<MergeResourceInclude Source="DualBadge.axaml" />
<MergeResourceInclude Source="Form.axaml" />
<MergeResourceInclude Source="IPv4Box.axaml" />
<MergeResourceInclude Source="KeyGestureInput.axaml" />
<MergeResourceInclude Source="Loading.axaml" />

View File

@@ -70,6 +70,7 @@ public class Form: ItemsControl
Content = control,
[!FormItem.LabelProperty] = control[!FormItem.LabelProperty],
[!FormItem.IsRequiredProperty] = control[!FormItem.IsRequiredProperty],
[!FormItem.NoLabelProperty] = control[!FormItem.NoLabelProperty],
};
}
}