Skip to content

feat: Add WinUI-shaped input validation - #24838

Merged
Xiaoy312 merged 60 commits into
masterfrom
dev/xygu/20260922/input-validation
Oct 21, 2026
Merged

Xiaoy312 merged 60 commits into
masterfrom
dev/xygu/20260922/input-validation

Conversation

@Xiaoy312

@Xiaoy312 Xiaoy312 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #4839, related: unoplatform/uno-private#2384

PR Type:

✨ Feature

What changed? 🚀

Before: Neither WinUI nor Uno supports input validation. INotifyDataErrorInfo works in the BCL, but nothing carries its errors from a binding source to the bound control. Apps have to build the whole presentation layer themselves.

After: Controls can opt in to input validation. Errors from an INotifyDataErrorInfo source reach the bound control's Validation.HasErrors / Validation.Errors attached properties, and drive WinUI's validation visual states and error presenter. The user-facing article is doc/articles/features/input-validation.md. Design and rationale are in specs/059-input-validation/spec.md (transport and read model) and specs/060-input-validation-presentation/spec.md (visuals). §10/§10b of 059 record where the implementation departed from the original draft.

Opt-in (off by default)

// Before the first binding is registered, i.e. before the first page's InitializeComponent
Uno.UI.FeatureConfiguration.InputValidation.IsEnabled = true;
<Page xmlns:input="using:Uno.UI.Xaml.Controls">
    <TextBox x:Name="UserNameBox"
             Text="{Binding UserName, Mode=TwoWay}"
             input:Validation.Mode="Auto" />
    <ItemsControl ItemsSource="{Binding (input:Validation.Errors), ElementName=UserNameBox}" />
</Page>

Validation is off unless both switches are set. With the global flag off, neither the binding registration path nor template application does extra work. Validation.Mode defaults to Disabled rather than WinUI's Auto, because here it also gates the INotifyDataErrorInfo subscription.

Transport

  • Registration happens where both SetBindingInternal overloads converge. Resolution runs on BindingExpression.OnValueChanged, which both {Binding} and {x:Bind} go through. The leaf source is read from the compiled binding's update sources as well as the binding path, so the two binding kinds behave the same (avoiding microsoft-ui-xaml#4642).
  • ErrorsChanged is subscribed weakly, so a view model cannot keep a control alive. A raise from another thread is dispatched to the UI thread. Teardown hooks ClearBinding, which covers rebinding and ClearValue.
  • The transport lives on Control (Control.Validation*.cs), where WinUI keeps the equivalent (CControl::IsValidationEnabled / EnsureValidationVisuals).
  • Validation.Errors mirrors the source: each synchronization replaces its contents in place (same collection instance), so errors an app adds itself do not survive the next one.

New public API (needs API review)

  • Uno.UI.Xaml.Controls.Validation (in Uno.UI.Extras): attached Mode, Kind, ErrorTemplate, HasErrors (read-only), Errors (read-only, created on demand). The WinAppSDK build of Uno.UI.Extras registers the same properties but nothing reads them, so markup stays portable.
  • Uno.UI.Xaml.Controls (in Uno.UI): InputValidationMode, InputValidationKind, InputValidationError, InputValidationPropertyAttribute, InputValidationPropertyMap.
  • Uno.UI.FeatureConfiguration.InputValidation: IsEnabled, ValidationProperties.
  • Control.UpdateValidationStates(): a new protected member on Control, inherited by every subclass. It lets a control outside Uno.UI re-apply the validation states from its own visual-state code. Uno.UI.Tests.ViewLibrary (not covered by InternalsVisibleTo) contains such a control, so the build fails if that contract regresses.

WinUI parity

"WinUI-shaped" means the visual state groups and state names, the ErrorPresenter template part, DefaultCompactErrorIconTemplate, and the member order of the enums. It does not mean the API:

  • WinUI's IInputValidationControl, InputValidationContext, InputValidationErrorEventArgs and the ValidationError / HasValidationErrorsChanged events are not ported. They live in WinUI's private IDL (PrivateApiContract / Feature_InputValidation), which has never shipped. Change notification on Validation.HasErrors and VectorChanged on Validation.Errors take their place.
  • The types live in Uno.UI.Xaml.Controls, not Microsoft.UI.Xaml.Controls, so they cannot collide if microsoft-ui-xaml#179 ships with a different shape.
  • HasValidationErrorsChangedEventArgs keeps its [Uno.NotImplemented] generated stub.
  • Other departures, all documented in spec 059: ComboBox validates SelectedItem (see below), Mode defaults to Disabled, Default counts as enabled, and there is no TryDefer.

Participants

The participants are WinUI's four: TextBox→Text, PasswordBox→Password, AutoSuggestBox→Text, ComboBox→SelectedItem. ComboBox departs from WinUI, which validates Text: a non-editable ComboBox is bound on SelectedItem, so validating Text would leave the common case with no errors. Any other control opts in with [InputValidationProperty] or a ValidationProperties registration. A misspelled attribute name logs a warning.

Presentation (spec 060, partial)

  • WinUI's InputValidationEnabledStates / InputValidationErrorStates are applied when the errors, Validation.Mode or Validation.Kind change, and when the template is applied.
  • Port of CControl::EnsureErrors / DeferErrors: the first error realizes the template's ErrorPresenter, which shows ErrorTemplate inline, or in the tooltip of DefaultCompactErrorIconTemplate for compact mode. An app can replace that icon from Application.Resources.
  • Not in this PR: the per-control default template changes (060 §4) and CommonStates contention (060 §3 / Q10). The shipped Fluent templates don't have validation parts yet, so nothing appears on screen unless the app's template or markup renders it.

Related fix

fix: Resolve attached properties of uninitialized owners (7177194): DependencyPropertyDescriptor.Parse redirected a parenthesized path to the owner type without running that type's static constructor. The lookup missed and the miss was cached, so {Binding (Owner.Property)} read the initial value once and never updated. This affected Canvas.Left too.

Tests & sample

  • Unit tests (Uno.UI.UnitTests/InputValidation/): transport, the property map, public surface guard, a third-party control, attached-path resolution, and the feature-off template path.
  • Runtime tests (Uno_UI_Xaml_Controls/InputValidation/): validation visual states (including errors raised off the UI thread) and the error presenter (including an app-level icon override).
  • Sample: Uno/UI/Xaml/Controls/Validation/InputValidation. It turns the global flag on in its own constructor; the rest of the SamplesApp runs with the feature off.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable)
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features)
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes — the feat! / refactor! commits only break API added earlier in this branch, which has never been released. Compared with master, the changes are additive and off by default.
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

🤖 Generated with Claude Code

@github-actions github-actions Bot added area/automation Categorizes an issue or PR as relevant to project automation kind/documentation labels Sep 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on 92c127f

The Uno.WinAppSDKSyncGenerator produced changes that are not committed on this PR.

To apply automatically (PRs from branches in this repo only): comment /apply-sync-gen on this PR and a bot will push chore: Sync generator run to the head branch.

To apply manually (required for PRs from forks):

  1. Download the sync-generator-patch artifact from this run.
  2. In your local checkout of the PR branch:
    git apply sync-generator.patch
    git add -A
    git commit -m "chore: Sync generator run"
    git push
    

Or re-run the generator locally on Windows via build\run-api-sync-tool.cmd.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 236518 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2304, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • DisplayInformation.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ImageIconPage.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Image_AnimatedWebP.png-dark
  • skia-windows-screenshots: 2304 changed over 2504

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AndroidWindowInsets.png-dark
    • AppBar_KeyBoard.png-dark
    • AppBarToggleButtonTest.png-dark
    • AppWindowClosing.png-dark
    • ApplicationViewSizing.png
    • AppWindowPresenters.png-dark
    • AppWindowPositionAndSize.png
    • Arrange_Performance01.png-dark
    • ArcSegment.png-dark
    • Attributed_text_Supserscript.png
    • Attributed_text_Simple.png
    • AutoBorderStretchwithrightmargin.png
    • AutoBorderStretchwithleftmargin.png-dark
    • AutomationProperties_Name.png
    • AutomationPropertiesExtensions_Role.png-dark
    • AutoSuggestBox_Icons.png
    • AutoSizedTopLeft.png
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBoxChosenSuggestion.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260922/input-validation branch from 92c127f to 80a2860 Compare October 1, 2026 14:41
Comment thread specs/059-input-validation/spec.md Resolved
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 236733 found UI Test snapshots differences: skia-linux-screenshots: 116, skia-windows-screenshots: 148

Details
  • skia-linux-screenshots: 116 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Examples.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • DisplayInformation.png-dark
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
  • skia-windows-screenshots: 148 changed over 2456

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • CalendarView_Theming.png-dark
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Examples.png
    • DisplayInformation.png-dark
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • ElementLevelTheme.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • ImageIconPage.png-dark

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 236770 found UI Test snapshots differences: skia-linux-screenshots: 116, skia-windows-screenshots: 149

Details
  • skia-linux-screenshots: 116 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • DisplayInformation.png-dark
    • Examples.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 149 changed over 2456

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Buttons.png-dark
    • Buttons.png
    • Focus_FocusVisual_Properties.png-dark
    • Grid_left_column_Auto.png-dark
    • Grid_left_column_Auto.png
    • Grid_Margin_And_Padding.png-dark
    • Grid_Margin_And_Padding.png
    • Grid_middle_col_auto__bottom_row_auto.png-dark
    • Grid_middle_col_auto__bottom_row_auto.png
    • Grid_MinWidth_MaxWidth.png-dark
    • Grid_MinWidth_MaxWidth.png
    • Examples.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237007 found UI Test snapshots differences: skia-linux-screenshots: 107, skia-windows-screenshots: 163

Details
  • skia-linux-screenshots: 107 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Examples.png
  • skia-windows-screenshots: 163 changed over 2456

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • DisplayInformation.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Grid_Multi_Column_Span.png-dark
    • Grid_Multi_Column_Span.png
    • Grid_RowSpan_Auto_WithText.png-dark
    • Grid_RowSpan_Auto_WithText.png
    • Grid_RowSpan_Right.png-dark
    • Grid_RowSpan_Right.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • Grid_in_GridClipping.png-dark
    • Grid_in_GridClipping.png

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 237007 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237533 found UI Test snapshots differences: skia-linux-screenshots: 120, skia-windows-screenshots: 163

Details
  • skia-linux-screenshots: 120 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DisplayInformation.png-dark
    • Buttons.png-dark
    • DropDownButtonPage.png-dark
    • Examples.png
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 163 changed over 2460

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Examples.png
    • ImageBrush_Formats.png-dark
    • ImageBrush_Formats.png
    • ImageIconPage.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Gamepad_CurrentReading.png-dark

@Xiaoy312
Xiaoy312 marked this pull request as ready for review October 5, 2026 22:10
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237558 found UI Test snapshots differences: skia-linux-screenshots: 130, skia-windows-screenshots: 151

Details
  • skia-linux-screenshots: 130 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
  • skia-windows-screenshots: 151 changed over 2460

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • CalendarView_Theming.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Examples.png
    • Gamepad_CurrentReading.png-dark
    • Grid_ColSpan_Bottom.png-dark
    • Grid_ColSpan_Bottom.png
    • Gamepad_Enumeration.png-dark
    • Grid_DataBound_ColumnRow_Definitions.png-dark
    • Grid_DataBound_ColumnRow_Definitions.png
    • Grid_def_MinMaxValues.png-dark

Xiaoy312 and others added 15 commits October 19, 2026 11:51
The handlers and the subscription lived in attached dependency properties,
a leftover from when a separate Validation class owned them. A single
lazily-created state object on Control now holds them.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The validation surface no longer lives on the WinUI types. The Mode, Kind,
ErrorTemplate, HasErrors and Errors properties are now attached properties
on Uno.Extras.Input.Validation, in Uno.UI.Extras. On WinAppSDK their
handlers are compiled out.

- IInputValidationControl is deleted, along with the per-control DPs and
  the HasValidationErrorsChanged, ValidationError and ErrorChanged events.
  The HasValidationErrorsChangedEventArgs stub is restored.
- InputValidationMode, InputValidationKind and InputValidationError move to
  Uno.Extras.Input and are compile-linked into Uno.UI.Extras.Windows.
- The engine stays on Control. It reads the attached DPs through an
  internal slot that Validation's static constructor fills, and a control
  participates through its validation property alone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Validation.Errors is created empty and then filled in place, so a
converter bound to it ran once on the empty collection and the sample
never showed an error.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Uno.UI.Extras is an assembly split, not a namespace root: its types
live under Uno.UI.*, so Uno.Extras.Input becomes Uno.UI.Xaml.Controls.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Template application ran a ValidationDisabled GoToState on every
templated control, even with input validation turned off globally.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The docs said an app may add its own errors, but every sync with the
source replaces the contents, so an added error is gone at the next
keystroke. Document that behavior and pin it with a test.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Master now requires [UITestClass] on every unit test class.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
DefaultCompactErrorIconTemplate is resolved at the application level, so
an app can replace it from Application.Resources. The spec also still
placed it in SystemResources.xaml, where master no longer defines it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A misspelled [InputValidationProperty] silently opted the control out.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260922/input-validation branch from 009b620 to 8655809 Compare October 19, 2026 20:53
@Xiaoy312

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Branch rebased on master, and here's what happened to each finding:

  1. Feature-off cost on template realization: fixed in 6d7722a. OnValidationTemplateApplied returns early when InputValidation.IsEnabled is off, and a unit test asserts no validation state is applied with the flag off.
  2. App-added errors wiped on sync: the doc was wrong, so it now matches the behavior (f91226c). Validation.Errors mirrors the source, and a test pins that an app-added error is removed by the next sync.
  3. PR description out of date: rewritten to match the head.
  4. Parity claim overstated: the description now says "WinUI-shaped" covers only state names, template parts and enum shapes. IInputValidationControl and its events are explicitly not ported.
  5. New protected Control.UpdateValidationStates: kept, and listed under "New public API (needs API review)" with the other new public types.
  6. Silent null for a misspelled [InputValidationProperty]: it now logs a warning (9f52dd1), once per type since the answer is memoized. The lookup still returns null rather than throwing.
  7. Per-sync allocation: left as is. The reconcile already keeps the collection and the matching error instances, so nothing churns. What's left is one small list per sync, and only on controls that opted in. A null error still becomes an empty-message error, which is consistent with "each error is its ToString()".
  8. Test gaps: background-thread ErrorsChanged is covered by 954bed9 (runtime test, Task.Run raise). The flag-off path is covered by 6d7722a, and the app-added-error contract by f91226c. When_Control_Is_Collected keeps its GC.Collect(), because forcing a collection is what the test is checking.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 240213 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Examples.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DropDownButtonPage.png-dark
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
  • skia-windows-screenshots: 2458 changed over 2490

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png
    • ApplicationViewSizing.png
    • AppWindowFeatures.png-dark
    • AppXamlDefinedResources.png-dark
    • Attributed_text_FontSize_Changing.png
    • AuthenticationBroker_Demo.png-dark
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_Landmark.png
    • AutomationProperties_Name.png-dark
    • AutoSuggestBox_BitmapIcon.png-dark
    • AutoSuggestBox_BitmapIcon.png
    • BackGesture.png-dark
    • BackGesture.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 240213 has failed on Uno.UI - CI.

@mergify

mergify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@Xiaoy312
Xiaoy312 merged commit 3763dac into master Oct 21, 2026
60 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20260922/input-validation branch October 21, 2026 00:13
Xiaoy312 added a commit to unoplatform/Uno.Themes that referenced this pull request Nov 25, 2026
- Phase A: Simple input styles gain validation visuals against the local validation build
- Phase B: temporary Validation shim until unoplatform/uno#24838 ships

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Xiaoy312 added a commit to unoplatform/Uno.Themes that referenced this pull request Nov 25, 2026
…noplatform/uno#24838

- Uno.Extras.Input.Validation (Mode, Kind, ErrorTemplate, HasErrors, Errors), InputValidationKind/Mode and InputValidationError, with the framework's API surface
- Mirrors INotifyDataErrorInfo errors of a single-segment {Binding} onto the control and drives the InputValidation* visual states and ErrorPresenter part
- Uno-only (HAS_UNO); lives in Uno.Themes.WinUI because the shared sample page compiles into every head
- SimpleSampleApp no longer sets FeatureConfiguration.InputValidation (absent without the framework implementation); left as a TODO
- To be deleted when bumping to the Uno version that ships unoplatform/uno#24838

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Xiaoy312 added a commit to unoplatform/Uno.Themes that referenced this pull request Nov 25, 2026
- unoplatform/uno#24838 shipped in the Uno build master already uses (7.1.0-dev.477), as Uno.UI.Xaml.Controls.Validation
- Point the styles, the sample page and the runtime tests at Uno.UI.Xaml.Controls instead of the temporary Uno.Extras.Input stand-in
- Enable FeatureConfiguration.InputValidation in SimpleSampleApp, before the first binding is registered
- The tests alias the validation types: Uno.UI.Xaml.Controls also declares a ComboBox

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for WinUI 3 Input Validation

6 participants