-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
TokenizingTextBox Text property cannot be set manually from code behind in Release mode #4749
Comments
Hello Dieveral, thank you for opening an issue with us! I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌 |
@LalithaNadimpalli this could be a good one for you to pick up next. Maybe see if you can reproduce in a new UWP project first? At least we can see if it's a general issue or specific to WinUI 3? @Dieveral what Windows App SDK version are you using in your app? (@Arlodotexe we probably want to add that to our issue form template too. (For both WinUI and WindowsAppSDK - do they support conditional questions based on other answers yet?)) |
I am reproducing the app in UWP using TokenizingTextBox code(XAML and .cs) but I see the issue user pointing to when I run the simple sample app provided |
Thanks @LalithaNadimpalli, want to attach your reproduction project here as well? I built this version of the control, so let me know if you have any questions in digging into what might be happening here when the text isn't being set. |
@michael-hawker I am using TokenizingTextBox control in UWP project. |
Synced with Laltiha and we think we found the root cause. We discovered that it looks like the Above the You can see the Still not sure why this is actually working in Debug vs. Release. But basically we think it's the You can actually see this if you try and set the default text value to the control as well, like: <controls:TokenizingTextBox Text="Some Text Here"/> The Text property reflects that, but not the initial state of the We'll want to do three things:
Lines 103 to 126 in fdaef47
Lines 107 to 113 in fdaef47
Example of getting the last token item from focus event here: Line 136 in fdaef47
That should hopefully resolve all these scenarios for this component. Potentially in the future we could see if we could do this better with some sort of binding like we setup for the QueryIcon, but not sure what ramifications that has on the other tokenizing logic, so for now this seems like the most straight-forward fix without impacting a lot of the other parts of the control. |
Split up a test case and added two new ones: Above is debug and we can see clearly the scenario not working for clearing the text. And when run in Release, we can see... Huh, the initial text scenario is working in the test... hmm. Will dig into it more as I work on fixing the other side. (Could have something to do with initialization timing when loading directly vs. how the sample app processes?) |
Sorted out the test: There was a rogue binding which should have been meaningless, and wasn't working as expected, but also somehow causing the test to pass even though the correct behavior wasn't working when tested in the sample app. Removed the binding and now the test fails as expected. Going to work to adding the proposed fixes in now and then can submit a PR. Did notice an issue when hitting the clear button in the textbox itself after typing on an existing token, but hope that'll be resolved as well, that'd be harder to test in the current setup. |
Close to fixing behavior, trying to test some other scenarios, and may have introduced a new bug. May have to try writing some UI tests here, looks like the first character received is being eaten now maybe.
|
Figured out the issue, was only setting the initial text for the last box. Should be resolved now. Not sure how to go about testing that yet, may need to beef up tests there in 8.0 world. |
…nityToolkit#4749 Think we maybe used to bind to the text directly, but there's no Text property directly on the TokenizingTextBoxItem, so this binding is meaningless. It doesn't effect the behavior of the textbox in practical usage, but somehow was doing something which was masking the problem for us to be able to detect within a test case. Removing it to reduce confusion. The text sync between the parent TokenizingTextBox collection of items (and the current edit) and the item is maintained through code-behind with text changing events. Though work is being done to resolve issues in this sync process. See issue CommunityToolkit#4749
Hook up initialization and change detection of parent Text property to update corresponding inner text of TokenizingTextBoxItem Failing tests from previous commit now pass.
…nityToolkit#4749 Think we maybe used to bind to the text directly, but there's no Text property directly on the TokenizingTextBoxItem, so this binding is meaningless. It doesn't effect the behavior of the textbox in practical usage, but somehow was doing something which was masking the problem for us to be able to detect within a test case. Removing it to reduce confusion. The text sync between the parent TokenizingTextBox collection of items (and the current edit) and the item is maintained through code-behind with text changing events. Though work is being done to resolve issues in this sync process. See issue CommunityToolkit#4749
Hook up initialization and change detection of parent Text property to update corresponding inner text of TokenizingTextBoxItem Failing tests from previous commit now pass.
…nityToolkit#4749 Think we maybe used to bind to the text directly, but there's no Text property directly on the TokenizingTextBoxItem, so this binding is meaningless. It doesn't effect the behavior of the textbox in practical usage, but somehow was doing something which was masking the problem for us to be able to detect within a test case. Removing it to reduce confusion. The text sync between the parent TokenizingTextBox collection of items (and the current edit) and the item is maintained through code-behind with text changing events. Though work is being done to resolve issues in this sync process. See issue CommunityToolkit#4749
Hook up initialization and change detection of parent Text property to update corresponding inner text of TokenizingTextBoxItem Failing tests from previous commit now pass.
Describe the bug
In Release mode TokenizingTextBox Text property cannot be set from code behind or with x:Bind. In Debug mode everything works as expected.
Regression
No response
Reproducible in sample app?
Steps to reproduce
Expected behavior
You can change Text property of TokenizingTextBox from code behind and with binding system in Release mood, as in Debug mood.
In sample app: Text must disappear after pressing 'Clear' button in Release mood.
Screenshots
Windows Build Number
Other Windows Build number
Windows 10 21H2 (Build 19044.1889)
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
2019
Visual Studio Build Number
16.11.17
Device form factor
Desktop
Nuget packages
Microsoft.NETCore.UniversalWindowsPlatform v6.2.12
Microsoft.Toolkit.Uwp.UI.Controls v7.1.12
Additional context
No response
Help us help you
No.
The text was updated successfully, but these errors were encountered: