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

Horizontally center SfComboBox

Good afternoon,
i'm trying to horizontally center a SfComboBox without success, seems that HorizontalOptions="Center" is not working.
If i try using a standard Xamarin.Forms Picker works fine, this is my code:

<ScrollView>
<StackLayout Padding="16">
<sfComboBox:SfComboBox HorizontalOptions="Center"/>
</StackLayout>
</ScrollView>

Using a standard Picker works fine:

<ScrollView>
<StackLayout Padding="16">
<Picker HorizontalOptions="Center"/>
</StackLayout>
</ScrollView>

Always uses all the available space; i have the same problem also inside a TextInputLayout.

Thanks in advance

4 Replies

HM Hemalatha Marikumar Syncfusion Team October 18, 2019 01:44 PM UTC

Hi Marco, 
 
Greetings from Syncfusion.  
 
Currently we are validating the reported query with SfComboBox and TextInputLayout, will update the complete details on October 21,2019. 
 
We appreciate your patience until then. 
 
Regards, 
Hemalatha M. 



KG Kanimozhi Gunasekaran Syncfusion Team October 21, 2019 12:57 PM UTC

Hi Marco, 
 
In a StackLayout, the SfComboBox default width has taken full size. So, we would like to let you know that the WidthRequest needs to be set for the SfComboBox to render at the center. Please have the code snippet below,  
 
Code Snippet: 
 <ScrollView>  
<StackLayout Padding="16">   
<combobox:SfComboBox HorizontalOptions="Center" WidthRequest="100" /> </StackLayout> 
 </ScrollView> 
 
Please check with the above and let us know if you have any concerns. 
 
Regards,
Kanimozhi G.
 



MN Marco Negroni October 28, 2019 01:47 PM UTC

Good afternoon,

inside a Grid is the same, takes always full space available.

Thanks in advance


RB Rabhia Beham Kathar Mideenar Syncfusion Team October 29, 2019 08:36 AM UTC

Hi Marco,

In a Grid, Entry also takes the full space. So, we would like to let you know that the WidthRequest and HeightRequest needs to be set for the SfComboBox to render at the center. Please have the code snippet below,

Code Snippet:

<ScrollView>
        <Grid>  
            <combobox:SfComboBox HorizontalOptions="Center"
                                 WidthRequest="100"
                                 HeightRequest="50"
                                 VerticalOptions="Center"/>
        </Grid>
 </ScrollView>

Please check with the above and let us know if you have any concerns.

Regards,
Rabhia Beham K.
 


Loader.
Up arrow icon