We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Text Input Layout Error Height when using Character count

Hi,

I'm using the TextInputLayout around an entry field, and it's working brilliantly for the most part, however i've just found that when applying an error it's growing the height of the control unreasonably tall. See the screenshot below as an example, the two red boxes are in error state and have a lot more extra height before the line below them. 


If i remove the character count it seems to be better, although it still looks a little too high compared to the one without error:


Any idea what i might be doing wrong, or anything i can set to stop this from happening?

The controls are just in a bindable stacklayout.

3 Replies

DV Divya Venkatesan Syncfusion Team January 2, 2020 04:04 PM UTC

Hi Mark, 
  
We have achieved your layout using Grid with TextInputLayouts inside StackLayout as shown in the below code snippet. We are not able to reproduce your issue while achieving this. 
  
Code snippet [Xaml]: 
  
    <StackLayout> 
        <BindableLayout.ItemsSource> 
            <ListCollection:List x:TypeArguments="x:String"> 
                <x:String>Item1</x:String> 
                <x:String>Item2</x:String> 
                <x:String>Item3</x:String> 
                <x:String>Item4</x:String> 
            </ListCollection:List> 
        </BindableLayout.ItemsSource> 
  
        <BindableLayout.ItemTemplate> 
            <DataTemplate> 
                <Grid> 
                    <Grid.ColumnDefinitions> 
                        <ColumnDefinition Width="*" /> 
                        <ColumnDefinition Width="3*" /> 
                    </Grid.ColumnDefinitions> 
                    <inputLayout:SfTextInputLayout 
                        BackgroundColor="Linen" 
                        ContainerType="Outlined" 
                        Hint="Rule Type"> 
                        <Entry Text="Contains" /> 
                    </inputLayout:SfTextInputLayout> 
                    <inputLayout:SfTextInputLayout 
                        Grid.Column="1" 
                        BackgroundColor="Linen" 
                        CharMaxLength="100" 
                        ContainerType="Outlined" 
                        ErrorText="Please enter value" 
                        HasError="True" 
                        Hint="Rule Value" 
                        ShowCharCount="True"> 
                        <Entry /> 
                    </inputLayout:SfTextInputLayout> 
                </Grid> 
            </DataTemplate> 
        </BindableLayout.ItemTemplate> 
    </StackLayout> 
  
Output Screenshot: 
 
  
  
Could you please check whether you can use this in your application? If not, please provide more details which would be helpful for us to assist you. 
  
Regards, 
Divya Venkatesan 
 



MA Mark January 3, 2020 01:06 PM UTC

Thanks - because i have something hidden i prefer to use stacklayout with horizontal orientation. See the following code which is based on your example:

<StackLayout Padding="40">
                    <BindableLayout.ItemsSource>
                        <ListCollection:List x:TypeArguments="x:String">
                            <x:String>Item1</x:String>
                            <x:String>Item2</x:String>
                            <x:String>Item3</x:String>
                            <x:String>Item4</x:String>
                        </ListCollection:List>
                    </BindableLayout.ItemsSource>

                    <BindableLayout.ItemTemplate>
                        <DataTemplate>
                            <!--<Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="3*" />
                                </Grid.ColumnDefinitions>
                            </Grid>-->
                            <StackLayout Orientation="Horizontal">
                                <inputLayout:SfTextInputLayout 
                        BackgroundColor="Linen" 
                        ContainerType="Outlined" 
                        Hint="Rule Type">
                                    <Entry Text="Contains" />
                                </inputLayout:SfTextInputLayout>
                                <inputLayout:SfTextInputLayout 
                        Grid.Column="1" 
                                    HorizontalOptions="FillAndExpand"
                        BackgroundColor="Linen" 
                        CharMaxLength="100" 
                        ContainerType="Outlined" 
                        ErrorText="Please enter value" 
                        HasError="True" 
                        Hint="Rule Value" 
                        ShowCharCount="True">
                                    <Entry />
                                </inputLayout:SfTextInputLayout>
                            </StackLayout>
                        </DataTemplate>
                    </BindableLayout.ItemTemplate>
                </StackLayout>

And Screenshot:




DV Divya Venkatesan Syncfusion Team January 6, 2020 11:59 AM UTC

Hi Mark, 
 
We are able to reproduce the issue when using StackLayout and we expect that this issue occurs in Xamarin.Forms Framework layout process while using certain layouts. Therefore, we recommend you to use Grid.  
 
If you are having any problems while using Grid, please let us know. We will assist you to sort out the problems. 
 
Regards, 
Divya Venkatesan 


Loader.
Live Chat Icon For mobile
Up arrow icon