feat: add temp template.

This commit is contained in:
rabbitism
2024-02-17 21:10:24 +08:00
parent 495b5651a7
commit a574fb76b4
12 changed files with 176 additions and 26 deletions

View File

@@ -3,7 +3,19 @@ using Avalonia.Controls.Primitives;
namespace Ursa.Controls;
public class FormGroup: HeaderedItemsControl, IFormItem
public class FormGroup: HeaderedItemsControl
{
protected override bool NeedsContainerOverride(object? item, int index, out object? recycleKey)
{
recycleKey = null;
return item is not FormItem or FormGroup;
}
protected override Control CreateContainerForItemOverride(object? item, int index, object? recycleKey)
{
if (item is not Control control) return new FormItem();
var label = Form.GetLabel(control);
var isRequired = Form.GetIsRequired(control);
return new FormItem() { Label = label, IsRequired = isRequired, Content = control };
}
}