alielie
2025-03-03 21e28b068c8d0763a6d4ab613388a77a0db157fb
HMI.UI/DpUtil/FormGroupHelper.cs
@@ -1,11 +1,8 @@
using System;
using System.ComponentModel;
using Panuon.WPF.UI;
using System.Windows;
using System.Windows.Controls;
using Panuon.WPF.UI;
using Panuon.WPF.UI.Configurations;
namespace HMI.UI
namespace HMI.UI.DpUtil
{
    public class FormGroupHelper
    {
@@ -62,7 +59,7 @@
                {
                    object content = fg.Content;
                    object value = GetValidateValue(content);
                    if (GetIsRequired(fg) && string.IsNullOrEmpty(value.ToString()))
                    if (value != null && GetIsRequired(fg) && string.IsNullOrEmpty(value.ToString()))
                    {
                        fg.ValidateResult = ValidateResult.Error;
                        fg.Message = $"{fg.Header}不能为空";
@@ -93,6 +90,7 @@
            if (content is ComboBox cBox) return cBox.Text;
            if (content is Panel panel) return GetValidateValue(panel.Children);
            if (content is NumberInput numberInput) return numberInput.Value;
            return null;
        }
    }