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

Autosize SfRotator-height

Hi,

I'm looking for a way to use a SfRotator with multiple text labels in a dynamic layout. The rotator should only use the vertical space it needs to properly show all contained labels.

I tried the following XAML:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="App1.MainPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:syncfusion_rotator="clr-namespace:Syncfusion.SfRotator.XForms;assembly=Syncfusion.SfRotator.XForms">

    <StackLayout>
        <syncfusion_rotator:SfRotator BackgroundColor="MistyRose">

            <syncfusion_rotator:SfRotator.DataSource>
                <syncfusion_rotator:SfRotatorItem>
                    <syncfusion_rotator:SfRotatorItem.ItemContent>
                        <Label Text="foo" />
                    </syncfusion_rotator:SfRotatorItem.ItemContent>
                </syncfusion_rotator:SfRotatorItem>
                <syncfusion_rotator:SfRotatorItem>
                    <syncfusion_rotator:SfRotatorItem.ItemContent>
                        <Label Text="bar" />
                    </syncfusion_rotator:SfRotatorItem.ItemContent>
                </syncfusion_rotator:SfRotatorItem>
            </syncfusion_rotator:SfRotator.DataSource>
        </syncfusion_rotator:SfRotator>

        <Label BackgroundColor="LightGreen" Text="Other control" />
    </StackLayout>
</ContentPage>

But the rotator seems to always use a fixed height, regardless of the SfRotatorItems:



How does one solve this?

Thank you very much, Ulrich

5 Replies

PA Paul Anderson S Syncfusion Team November 14, 2018 05:42 AM UTC

Hi Ulrich Wiedemann, 
  
Greetings from Syncfusion. 
  
We have analyzed the reported issue “SfRotator seems to always use a fixed height”. We are able to reproduce the reported issue and we have already logged a bug report for this. The fix will be included our upcoming Volume 4 release which will be rolled out in the mid of December 2018. 
  
Please let us know if you have any other concern. 
  
Regards, 
Paul Anderson 



UN Unknown Syncfusion Team January 7, 2019 12:07 PM UTC

Hi Paul Anderson,

thank you for your support. I updated my little test project to SfRotator 16.4.0.44 (Xamarin Forms 3.4.0.1009999) and got unfortunately the very same result on Android and iOS. Furthermore I was not able to spot a related fix in the release notes for 16.4.*.

Do you have an idea what I'm doing wrong?

Regards, Ulrich Wiedemann


DR Dhanasekar R Syncfusion Team January 8, 2019 10:50 AM UTC

Hi Ulrich,  
 
Thanks for the update. 
 
Since Rotator can be populated with multiple items and which can have different content and dimensions it is recommended to specify the HeightRequest and WidthRequest as per your requirement. 
 
  <StackLayout Padding="50">
        <syncfusion_rotator:SfRotator BackgroundColor="MistyRose" HeightRequest="25">
            <syncfusion_rotator:SfRotator.DataSource>
                <syncfusion_rotator:SfRotatorItem>
                    <syncfusion_rotator:SfRotatorItem.ItemContent>
                        <Label Text="Rotator Item 1" />
                    </syncfusion_rotator:SfRotatorItem.ItemContent>
                </syncfusion_rotator:SfRotatorItem>
                <syncfusion_rotator:SfRotatorItem>
                    <syncfusion_rotator:SfRotatorItem.ItemContent>
                        <Label Text="Rotator Item 2" />
                    </syncfusion_rotator:SfRotatorItem.ItemContent>
                </syncfusion_rotator:SfRotatorItem>
            </syncfusion_rotator:SfRotator.DataSource>
        </syncfusion_rotator:SfRotator>
        <Label BackgroundColor="LightGreen" Text="Xamarin Label" />
    </StackLayout> 
  
Output Image
 
 
 
Regards, 
Dhanasekar 
 



UN Unknown Syncfusion Team January 9, 2019 09:44 AM UTC

Hello Dhanasekar,

Thank you for your response.

While giving a static height to the control may work for simple cases, it's no viable option for more complex scenarios or rather provides a limited user experience. 

We display several user defined strings in the rotator and want the layout to adjust - as with any other control like a label. For this to work, the rotator needs to respond reasonably to Measure() requests according to its content's needs.

There are more informations on the page, so that the space should be devided, e.g. if the rotator needs little space, there is more room for the other information and vice versa.

We already tried to handle this in an own layout, but as long as the SfRotator does not Measure() correctly this is quite impossible.

Do you plan to fix the Measure() behavior of SfRotator anytime soon?

Regards, Ulrich


DR Dhanasekar R Syncfusion Team January 10, 2019 10:39 AM UTC

Hi Ulrich, 
 
Thanks for explaining your requirement. 
 
In our current implementation of SfRotator we do not have support to measure SfRotator content size due to performance consideration. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts. We have added this feature request to our database. You can now track the current status of this feature request here.  
 
https://www.syncfusion.com/feedback/4219
 
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. 
 
Regards, 
Dhanasekar 


Loader.
Live Chat Icon For mobile
Up arrow icon