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

AutoSuggestBox does not have a way to disable spell checking #9249

Closed
lucas-yotsui opened this issue Jan 14, 2024 · 4 comments
Closed

AutoSuggestBox does not have a way to disable spell checking #9249

lucas-yotsui opened this issue Jan 14, 2024 · 4 comments
Labels

Comments

@lucas-yotsui
Copy link

Describe the bug

I'm new to WinUI so I don't have a lot of knowledge on how all this stuff works, why some things were implemented the way they were, etc, etc. But I have noticed that the AutoSuggestBox elements do not have any way to disable the spell checking, which in my opinion does not make any sense! The text input by the user and the options shown are not always considered grammarly correct.

Take for example the application I'm currently developing, in which we have an AutoSuggestBox used for a group of names that are all acronyms. those are perfectly valid names for our application, however I keep getting red squiggly lines every time I use it.

I believe this problem can be easily solved by giving this element a IsSpellCheckEnabled field just like a regular TextBox field.

(Sorry if my english is not the best, it isn't my first language ¯\(ツ)/¯ )

Steps to reproduce the bug

I don't think any code sample is really needed here, just implement a simple AutoSuggestBox and input it with anything not grammarly correct.

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@lucas-yotsui lucas-yotsui added the bug Something isn't working label Jan 14, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 14, 2024
@kmgallahan
Copy link
Contributor

<AutoSuggestBox>
  <AutoSuggestBox.TextBoxStyle>
    <Style TargetType="TextBox">
      <Setter Property="IsSpellCheckEnabled" Value="False" />
    </Style>
  </AutoSuggestBox.TextBoxStyle>
</AutoSuggestBox>

@bpulliam bpulliam added team-Controls Issue for the Controls team area-AutoSuggestBox needs-author-feedback Asked author to supply more information. question and removed needs-triage Issue needs to be triaged by the area owners bug Something isn't working labels Jan 18, 2024
@lucas-yotsui
Copy link
Author

<AutoSuggestBox>
  <AutoSuggestBox.TextBoxStyle>
    <Style TargetType="TextBox">
      <Setter Property="IsSpellCheckEnabled" Value="False" />
    </Style>
  </AutoSuggestBox.TextBoxStyle>
</AutoSuggestBox>

Sorry guys, clearly it was a skill issue here, as I had no idea this was even possible. However, I noticed that when I did this my query icon disapperared, is there any way I can keep it while doing this? The icon is actually an important part of my design

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-triage Issue needs to be triaged by the area owners and removed needs-author-feedback Asked author to supply more information. no-recent-activity labels Jan 26, 2024
@kmgallahan
Copy link
Contributor

kmgallahan commented Jan 26, 2024

<AutoSuggestBox QueryIcon="Find">
  <AutoSuggestBox.TextBoxStyle>
    <Style BasedOn="{StaticResource AutoSuggestBoxTextBoxStyle}" TargetType="TextBox">
      <Setter Property="IsSpellCheckEnabled" Value="False" />
    </Style>
  </AutoSuggestBox.TextBoxStyle>
</AutoSuggestBox>

FYI, not all MUXC (Microsoft.UI.XAML.Controls) controls have properties that allow you to set styles for internal parts of the control like AutoSuggestBox.TextBoxStyle.

Using BasedOn here is stating the style should inherit everything found in the default style AutoSuggestBoxTextBoxStyle, which can be found in your generic.xaml file, which is typically located here-ish:

C:\Users\<username>\.nuget\packages\microsoft.windowsappsdk\<wasdkversion>\lib\<platform>\Microsoft.WinUI\Themes

In my case:

C:\Users\kmgal\.nuget\packages\microsoft.windowsappsdk\1.4.231219000\lib\net6.0-windows10.0.18362.0\Microsoft.WinUI\Themes

It is a 36K line file that contains default styles and named 'light-weight' styles to set some individual values. You can also copy+paste entire styles to edit and "reskin" MUXC controls without starting from scratch.

@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Feb 23, 2024
@lucas-yotsui
Copy link
Author

<AutoSuggestBox QueryIcon="Find">
  <AutoSuggestBox.TextBoxStyle>
    <Style BasedOn="{StaticResource AutoSuggestBoxTextBoxStyle}" TargetType="TextBox">
      <Setter Property="IsSpellCheckEnabled" Value="False" />
    </Style>
  </AutoSuggestBox.TextBoxStyle>
</AutoSuggestBox>

Thank you so much, this worked perfectly!

Clearly I have much to learn on XAML and WinUI I'm general, thanks for the tips and the solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants