-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Height of Entry with data binding incorrect on UWP when Entry in ScrollView in Grid #2172
Comments
Checked against the 3.0.0-pre to verify that the code still reproduces the behavior |
@pauldipietro - Is there any updated on this? I've just upgraded from XF 2.4 to 3.2.0.839982 and really wasn't expecting this to still be present (which it is). |
I couldn't use stacklayout or grid but I was able to use flexlayout within a scrollview along with entry boxes. |
This is still an issue on 4.2.0 eg:
The first entry, which has not had the font size changed, renders with the correct height for the default font size. additional: the second entry will resize itself if you resize the application window. |
I am now doing a workaround similar to the one mentioned above, but instead of fiddling with the value in the viewmodel, I am changing the font size. this seems like a safer thing to do, and it appears to work. |
@MitchBomcanhao When are you doing the font size change? Assuming MVVM pattern are you doing it in the view code behind? I've been trying to work around this very annoying issue also. It get's worse the more nested layouts get. |
@jfversluis I was watching your stream on the iOS font attribute issue the other day. I noticed similar code in the UWP Entry renderer to what you were tweaking in the iOS label renderer when the font is updated. I was just half watching while working, so I could be way off base that this is even related to this issue, just throwing out the thought. bool entryIsDefault = entry.FontFamily == null && entry.FontSize == Device.GetNamedSize(NamedSize.Default, typeof(Entry), true) && entry.FontAttributes == FontAttributes.None; I've been poking around the UWP code base to see if I could find a start to maybe looking into this issue, but I'm not very familiar with the whole layout process. |
@bmacombe I'll share my workaround tomorrow when I get back to my workstation. It's executed on an override to onbindingcontextchanged in the code behind of the control that includes the entry, and I switch the size to a slightly smaller size, wait and then set it to a larger size. I'm also only doing it on uwp and if the value in the Viewmodel isn't null or empty. Might still suffer from timing issues, but less troublesome than messing around with the value in the Viewmodel. |
@bmacombe here it goes. not great at all, but might help someone.
|
@MitchBomcanhao Thanks I was playing around with the XF codebase yesterday, but didn't make much progress. I couldn't quickly modify one of the existing issues in the ControlGallery to replicate it. I only notice the problem when I'm using SfTextLayout control. Could you send the layout you used to create your sample above? I'll trying making a repro work in the control gallery and then see if I can figure out what the issue is, if I can make sense of the layout system. I'm thinking it has to be something like a timing issue. It's measuring the size of the entry before updating the font or something. |
This seems like an issue in the UWP code, it's the native measure that is returning the incorrect size |
Bug report best practices: https://github.com/xamarin/Xamarin.Forms/wiki/Submitting-Issues
Description
On complex pages on UWP, the height of Entry views can be incorrect, clipping the bottom of the text in the Entry. This occurs when the Entry uses data binding, and is in a Layout inside a ScrollView inside a Grid.
Steps to Reproduce
Using the following code with Xamarin.Forms 2.4.0.38779, push an instance of the BugUWPEntryBindingPageView page onto the navigation stack. Press the Button that appears at the top of the page and view the Entry that then appears. On UWP, the Entry is clipped.
Then, to see a nasty workaround, change the WorkaroundBug boolean to true and run again.
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ViewsUsingXamarinForms
{
public class BugUWPEntryBindingViewModel : BindableObject
{
public static readonly BindableProperty ValueOneProperty
= BindableProperty.Create(
nameof(ValueOne),
typeof(string),
typeof(BugUWPEntryBindingViewModel),
default(string));
}
Expected Behavior
Expect to see "123"
Actual Behavior
Expect to see "123" but with bottom of text clipped.
Basic Information
Screenshots
Reproduction Link
The text was updated successfully, but these errors were encountered: