| | |
| | | { |
| | | if (child is FormGroup fg) |
| | | { |
| | | if (fg.Visibility != Visibility.Visible) |
| | | { |
| | | ClearValue(fg); |
| | | continue; |
| | | } |
| | | fg.ValidateResult = ValidateResult.None; |
| | | fg.Message = null; |
| | | object content = fg.Content; |
| | |
| | | if (content is ComboBox cBox) return cBox.SelectedItem ?? cBox.SelectedValue ?? cBox.Text; |
| | | |
| | | if (content is Panel panel) return GetValidateValue(panel.Children); |
| | | if (content is NumberInput numberInput) return numberInput.Value; |
| | | if (content is Panuon.WPF.UI.NumberInput numberInput) return numberInput.Value; |
| | | if (content is PasswordBox passwordInput) return passwordInput.Password; |
| | | return null; |
| | | } |
| | | |
| | | private static void ClearValue(object content) |
| | | { |
| | | if (content == null) return; |
| | | if (content is UIElementCollection elementCollection && elementCollection.Count > 0) |
| | | ClearValue(elementCollection[0]); |
| | | if (content is TextBox tb) tb.Text = null; |
| | | if (content is CheckBox cb) cb.IsChecked = null; |
| | | if (content is ComboBox cBox) |
| | | { |
| | | cBox.SelectedItem = null; |
| | | cBox.SelectedValue = null; |
| | | cBox.Text = null; |
| | | } |
| | | |
| | | if (content is Panel panel) ClearValue(panel.Children); |
| | | if (content is Panuon.WPF.UI.NumberInput numberInput) numberInput.Value = null; |
| | | if (content is PasswordBox passwordInput) passwordInput.Password = null; |
| | | } |
| | | } |
| | | } |