microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.32k stars 676 forks source link

Input Validation applied for {x:Bind} but not {Binding} #4642

Open omnilogix opened 3 years ago

omnilogix commented 3 years ago

Describe the bug

When using InputValidation, the validation does not get applied to bindings of type {Binding}, but does for {x:Bind}

Steps to reproduce the bug

Run attached solution

Reunion.zip

Xaml:

    <Grid x:Name="_Grid">
        <Grid.Resources>
            <local:MainWindowViewModel x:Name="VM" />
        </Grid.Resources>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
            <TextBox InputValidationKind="Inline" Header="Test1" Text="{x:Bind VM.Test1, Mode=TwoWay}" HorizontalAlignment="Left" Width="200" />
            <TextBox InputValidationKind="Inline" Header="Test2" Text="{Binding VM.Test2, Mode=TwoWay}" HorizontalAlignment="Left" Width="200" />
        </StackPanel>
    </Grid>

Expected behavior

Correct validation regardless of binding type

Screenshots

image

Version Info

image

NuGet package version:

Windows app type: UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

After an invalid input is made, entering valid data and tabbing away does not clear the error Also note misalignment issue documented here: https://github.com/microsoft/microsoft-ui-xaml/issues/4640#issue-839871036 InputValidation seems to have many issues related to consistent application across controls, and functionality like ErrorTemplate, error positioning, etc.

omnilogix commented 3 years ago

Please move this to the ProjectReunion repo

StephenLPeters commented 3 years ago

Please move this to the ProjectReunion repo

Why do you want this moved? it seems likely a winui issue.

omnilogix commented 3 years ago

Because I keep getting confused what belongs to WinUI 3 / Project Reunion / Windows Toolkit... ;) If it belongs here, great!

omikhailov commented 3 years ago

AFAIK, this is by design

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

omnilogix commented 1 year ago

Any progress on this item?