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

Dynamic Rotator Items containing dynamic Grid data

Hello,

I'm working on a project where the logged in user may have n # of data tables of similar data being pulled from a web service.  The data returned always contains the same data schema but the identifier would be different.  One user may have 1 set of data and another user may have 5 sets of data.

My goal is to dynamically add Rotator items to match the returned data set for the user.

If the user only has 1 data table of data, only one rotator item listing the data in a grid would be shown.  If the user has 5 sets of data, there would be 5 rotator items each containing a grid displaying the data.

Is this possible to achieve using the SfRotator control with the ItemTemplate containing Grids of data that are all uniquely bound?

Thank you,
Mitch

3 Replies

MK Muneesh Kumar G Syncfusion Team April 25, 2019 12:01 PM UTC

Hi Mitch, 
 
Greetings from Syncfusion. 
 
We have analyzed your requirement and we have prepared a sample based on this. We have implemented the SfRotator’s ItemTemplate with SfDataGrid and displayed the same data that bound with view as per the below code snippet.  
 
 
In this sample, we have done the following things, 
 
1. Added SfDataGrid as an ItemTemplate in Rotator and also set binding for the Rotator and DataGrid ItemsSource. Please refer below code snippet for this 
 
 <ContentPage.BindingContext>
        <local:OrderInfoRepository />
    </ContentPage.BindingContext>
    <ContentPage.Content>
        <StackLayout>
            <Button x:Name="Add"  Clicked="Add_Clicked" Text="Add" HorizontalOptions="Center" VerticalOptions="Center" />
            <rotator:SfRotator x:Name="rotator" ItemsSource="{Binding RotatorCollection,Mode=TwoWay }" NavigationDirection="Horizontal" NavigationStripMode="Thumbnail" NavigationStripPosition="Bottom">
                <rotator:SfRotator.ItemTemplate>
                    <DataTemplate>
                       <dataGrid:SfDataGrid ItemsSource="{Binding OrderInfoCollection,Mode=TwoWay}" />
                    </DataTemplate>
                </rotator:SfRotator.ItemTemplate>
            </rotator:SfRotator>
        </StackLayout>
    </ContentPage.Content> 
 
 
2. Added the button click to change the Rotator Items and data of SfDataGrid dynamically. 
 
Please refer the below screenshot for this 
 
 
 
 
We request you to try our sample, if this is not your requirement please get back to us with further details. 
 
Thanks, 
Muneesh Kumar G. 



PR Padmini Ramamurthy Syncfusion Team April 29, 2019 05:24 AM UTC

From: Mitch Harhay
Sent: Friday, April 26, 2019 6:28 PM
To: Syncfusion Support <support@syncfusion.com>
Subject: Re: Syncfusion support community forum 144210, Dynamic Rotator Items containing dynamic Grid data, has been updated. 

Thank you - this worked perfectly.
 



MK Muneesh Kumar G Syncfusion Team April 29, 2019 05:45 AM UTC

Hi Mitch,  
 
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
   
Thanks,   
Muneesh Kumar G.   
 


Loader.
Live Chat Icon For mobile
Up arrow icon