Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Setting InputScope in XAML Style Fails when Applied to Multiple Controls #3333

Open
robloo opened this issue Sep 25, 2020 · 4 comments
Open
Labels
area-Styling area-TextBox TextBox, RichEditBox bug Something isn't working team-Controls Issue for the Controls team

Comments

@robloo
Copy link
Contributor

robloo commented Sep 25, 2020

Describe the bug

Attempting to set the same InputScope value in a XAML defined style to multiple controls will fail. For example, the following XAML markup will fail to work as expected for the second TextBox and it will have null assigned for the InputScope instead of Number.

    <Page.Resources>
        <Style TargetType="TextBox">
            <Setter Property="InputScope" Value="Number" />
        </Style>
    </Page.Resources>
    <StackPanel>
        <TextBox Text="hello world!" x:Name="textBox"/>
        <TextBox Text="hello world 2!" x:Name="textBox2"/>
    </StackPanel>

Originally discussed with @RealTommyKlein @StephenLPeters here: #3186 (comment)

This appears to only be a problem in styles. The style seems to be creating a single instance of the InputScope object and then when it attempts to apply it to multiple controls it fails -- possible because it already has a parent after setting to the first control.

Steps to reproduce the bug

See above XAML

Expected behavior

Multiple InputScope objects should be created -- one for every instance of the control. The InputScope should be set successfully when set in a style and that style is applied to multiple controls.

Version Info

NuGet package version:

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041) Yes
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

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Sep 25, 2020
@StephenLPeters
Copy link
Contributor

@MikeHillberg or @Austin-Lamb do either you know why input scope is behaving so strangely?

@StephenLPeters
Copy link
Contributor

Putting it on framework, because input scope is mostly a text box property, but the bug could be in one of a handful of places.

@chrisglein chrisglein added area-Styling area-TextBox TextBox, RichEditBox and removed needs-triage Issue needs to be triaged by the area owners labels Mar 2, 2021
@chrisglein
Copy link
Member

Not sure why this isn't a shareable instance. This seems like it should be a plain old data type, not something with state.

@robloo
Copy link
Contributor Author

robloo commented Jul 19, 2023

This, along with the discussion in associated PR, was probably a deep issue that still needs to be understood.

@bpulliam bpulliam added team-Controls Issue for the Controls team and removed team-Framework labels Aug 22, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Aug 22, 2023
@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Aug 29, 2023
@duncanmacmichael duncanmacmichael added the bug Something isn't working label Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Styling area-TextBox TextBox, RichEditBox bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

5 participants