Get the Selected item or ItemTabbed

Good Day Admin 

i have a Rotator that i bind from an object , now on tapped event i want to get the selected or tabbed item on the rotator. the defination of my rotator is like this 


                <rotator:SfRotator BackgroundColor="Transparent"
                                   DotsBorderColor="Transparent" 
                                   UnselectedDotColor="{DynamicResource Gray-200}"
                                   SelectedDotColor="{DynamicResource PrimaryColor}"  
                                  ItemTapped="rotator_ItemTapped"
                                   SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
                                   NavigationStripMode="Dots"
                                   NavigationStripPosition="Bottom"
                                   DotPlacement="Default"
                                   HeightRequest="525"
                                   x:Name="rotator" 
                                   Margin="8, 0">
                    <rotator:SfRotator.ItemTemplate>
                        <DataTemplate>
                            <StackLayout Spacing="0">
                                <controls1:CustomShadowFrame x:Name="Rotator" BackgroundColor="{DynamicResource Gray-White}" 
                                                        BorderColor="{DynamicResource Gray-White}" BorderWidth="1" 
                                                        CornerRadius="4" HasShadow="True" Margin="4" Padding="0">

                        
  
                                        <ffimageloading:CachedImage Aspect="AspectFill"
                                        CacheDuration="14"  HeightRequest="525"   
                                       BackgroundColor="{DynamicResource Gray-White}"
                                       DownsampleUseDipUnits="True"  RetryCount="5"  RetryDelay="5"   
                                        LoadingPlaceholder="loadinghourglass.gif" ErrorPlaceholder="no_pofile_pic.png"
                                          DownsampleToViewSize="true"
                        Source="{Binding IMAGE_VIDEO_URL}"  >
                                    
                                        </ffimageloading:CachedImage>
 
                                </controls1:CustomShadowFrame>
                             
                            </StackLayout>
                        </DataTemplate>
                    </rotator:SfRotator.ItemTemplate>
                </rotator:SfRotator>

i tried this 


    private void Rotator_ItemTapped(object sender, EventArgs e)
        {
            var itemselected  = e. as USER_PHOTOS_MODEL;
            if(itemselected!=null)
            {
                m_selected_image = itemselected; 
            }

        }

 e event args does not contain an item 

Thanks  

3 Replies 1 reply marked as answer

RS Ruba Shanmugam Syncfusion Team January 29, 2021 10:16 AM UTC

Hi Vuyiswa,

Greetings from Syncfusion.

We have validated your query and we have prepared sample based on your requirement using ItemTapped event and get the SelectedItem using rotator tems collection and selected index. We have prepared a sample for your reference get the sample and code snippet from below.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/RotatorSelectedItem120441993

Code Snippet: 

  
 XAML.cs:
private void rotator_ItemTapped(object sender, EventArgs e)
{
          var itemSelected = viewModel.ImageCollection[rotator.SelectedIndex] as RotatorModel;
          if (itemSelected != null)
          {
              m_selected_image = itemSelected.Image;
          }
}
 

Please let us know, if you have any concern on this.

Regards,
Ruba Shanmugam

Marked as answer

VU Vuyiswa January 30, 2021 07:14 PM UTC

Good Day Admin 

Your example solved my problem. In the future are you looking at adding a selected item property to the Rotator ? Because Selectedindex option requires one to save the binded items of the Rotator to a variable. 

Thanks my Issue is resolved 


RS Ruba Shanmugam Syncfusion Team February 1, 2021 07:36 AM UTC

Hi Vuyiswa,

Thanks for the update.

We would like to let you know that, We have logged a feature request for your requirement “Provide SelectedItem support for SfRotator” , it can be tracked through our feedback portal below.

Feedback link: https://www.syncfusion.com/feedback/21942/need-to-provide-selecteditem-support-for-sfrotator

Please cast your vote to make it count. We will prioritize the features every release based on the demands and we do not have an immediate plan to implement this feature since we committed with already planned work. So, this feature will be available for any of our upcoming releases.

If you have any more specifications/suggestions to the feature request, you can add it as a comment in the portal.

Regards,
Ruba Shanmugam

Loader.
Up arrow icon