-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] Entry text initially invisible on UWP #8787
Comments
#8214 might resolve this. I noticed similar when testing for that PR |
Yes I've also noticed this happening since the latest Xamarin Forms version. |
@WayaFlyfeather I took the changes from #8536 and made them to #8214 to see if they resolved the issue I was attempting to resolve. Without 8536, this is how the issue page 2172 looks without applying style changes. The green section is with the 2172 renderer changes and the red is with the unmodified renderer. With 8536, it seems to cause two text boxes that worked correctly with 8214 to regress and it does fix most of the boxes in the red, but not the auto size editor. I think it's safe to say there is something strange going on with FormsTextBox that we all haven't exactly nailed down yet. I tried to reproduce the 2172 issues with stock UWP and couldn't |
I'm encountering the same issue. Please fix asap. |
Same problem here. I can not update to 4.3 until this is fixed. |
I noticed this behavior if you change the Text while the Entry is hidden. |
Same issue here. Also looking for a workaround... |
I've come up with a workaround. Here you go:
|
Thanks @jsiemens for the work around. To make it work for Entry Controls (as the bug describes) I just changed the renderer to an EntryRenderer. Also needed some additional null checks, ended up with
But XF-team, please fix! |
I've tried the workaround and it works fine for short strings. But if the string is long and needs to be wrapped, the text is not displayed, and it is only displayed when you resize the window. Without the workaround, short texts are not displayed, but long texts that need to be wrapped are. |
I've updated the workaround so that it also works with strings that have to be wrapped: protected override void OnElementChanged (ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged (e);
if (Control == null) { return; }
if (e.OldElement != null && Control != null)
{
Control.Loaded -= Control_Loaded;
}
if (e.NewElement != null && Control != null)
{
Control.IsEnabled = true;
Control.Loaded += Control_Loaded;
}
}
private void Control_Loaded (object sender, RoutedEventArgs e)
{
// Hack workaround for: https://github.com/xamarin/Xamarin.Forms/issues/8787
Control.Text = string.Empty;
Control.Text = Element?.Text ?? string.Empty;
Control.Loaded -= Control_Loaded;
}
|
In case it helps anyone, I did find that my originally solution didn't always work. I settled on the following approach which has proven to work 100% of the time as tested. This is specifically for Editor, rather than Entry, so the existing workaround for Entry may be reliable, and this code is specifically looking for a certain named element within the control template so it wouldn't work for Entry although something similar could maybe be done.
|
Yep, GitHub got a little excited. Thanks, @bmacombe ! |
This bug prevents me to update my project for nearly six month. It would be really a pleasure if it could be solved in the next service release. Thank you. |
@sude22 i think it fixed in 4.8 pre1 because my editor finally works fine |
#11140 which is in 4.8 and the latest 4.7 SR I believe partially fixed the text visibility problem on UWP. It really depends on your layout if it was or not. You could still have problems currently if you have a really nested layout. |
With V4.7.0.1142+463-sha.333e71c12-azdo.3888487 I still have the problem. |
Do we think this will be in the next 4.7.0 SR or shal I implement the workaround from here: #8787 (comment) |
For me, this issue seems to be fixed in 4.7.0.1179. |
closed by #11351 |
I'm seeing this problem again in v4.8.0.1269, had to re-activate the workaround above to get the values to show on UWP. |
For me v4.8.0.1269 is the first release to fix the problem. |
Hmm. I had a form with several Entry boxes (IsEnabled="false" on them to make them read only, if that matters). I set their bound property in the VM and on iOS, the values appear. On UWP, they did not appear. I turned on the fix above with the EntryRenderer (we'd implemented it when we saw this problem before, but had since disabled it) and the values started appearing on UWP as they were on iOS. |
@cmpalmer66 Can you create a repro project? I just pulled the 4.8 branch and tested all the test pages and everything still looks good. |
If you can, probably best to create a new issue also since this one was closed. |
I will try. Maybe it's a coincidence or glitch, but I'll see what I can do and create a new issue if I can duplicate. |
If you do, ping me on it and I'll try to take a look. I want to squash all these UWP not showing until resizing issues, they are driving me nuts too! |
Should this issue be reopened or is there a build of XF that has fixed this issue? |
Guys, this is the solution that works for me 100% but none of the above, my XF version 4.7.0.1351
|
Description
On UWP, with a certain combination of views and layouts, there is a circumstance where text in an entry will initially be invisible. This can be remedied in the app by resizing the windows or clicking into the entry. Based on my investigation, there seems to be an issue where the the actual element that holds the text in UWP is not full size.
We also observed a similar but not quite the same issue when there are entries in a List View in a view cell where the text will not appear unless the cursor is brought near the entry. I don't have a repro for this yet but I bring it up because it might be related.
Finally, while I was able to make it appear by setting a height request, the behavior is not quite predictable. In our production apps, setting/not setting height requests was not able to change anything. In our production apps, we fixed it by setting a width request of 5 which for some reason resolved it in our environment.
Steps to Reproduce
Repro project below
Expected Behavior
Text should appear initially upon page load as it does on Android and iOS.
Actual Behavior
The text is not initially visible in entries unless they are resized or interacted with.
Basic Information
Microsoft.NETCore.UniversalWIndowsPlatform 6.2.9,
Xamarin.Essentials 1.3.1
Screenshots
Issue on UWP,
Issue not present on iOS as an example,
Reproduction Link
https://github.com/squinn7/EntryBindingRepro
The text was updated successfully, but these errors were encountered: