Class SfRotator
Represents a control that allows user to showcase a collection of items that can slide either vertically or horizontally.
Inheritance
Namespace: Syncfusion.Maui.Rotator
Assembly: Syncfusion.Maui.Rotator.dll
Syntax
public class SfRotator : View, IRotator, IView, IElement, ITransform, IParentThemeElement, IThemeElement
Examples
The below example shows how to initialize the Rotator control.
SfRotator rotator = new SfRotator();
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
Constructors
SfRotator()
Initializes a new instance of the SfRotator class.
Declaration
public SfRotator()
Fields
CommandParameterProperty
Identifies the CommandParameter bindable property. It is a parameter to pass to the Command property. This is a bindable property.
Declaration
public static readonly BindableProperty CommandParameterProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This bindable property is read-only.
CommandProperty
Identifies the Command bindable property. It invokes when the button is activated. The default value is null.
Declaration
public static readonly BindableProperty CommandProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This bindable property is read-only.
DotPlacementProperty
Identifies the DotPlacement bindable property. The value determines the placement of Dots representation.
Declaration
public static readonly BindableProperty DotPlacementProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
DotsStrokeProperty
Identifies the DotsStroke bindable property. The border color of the Dots representation.
Declaration
public static readonly BindableProperty DotsStrokeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableAutoPlayProperty
Identifies the EnableAutoPlay bindable property. The value that indicates whether to enable or disable auto sliding of the items.
Declaration
public static readonly BindableProperty EnableAutoPlayProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableLoopingProperty
Identifies the EnableLooping bindable property. The value enables or disables the cyclic sliding behavior when selection reaches the last item.
Declaration
public static readonly BindableProperty EnableLoopingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableSwipingProperty
Identifies the EnableSwiping bindable property. The value that enables or disables swipe touch gesture.
Declaration
public static readonly BindableProperty EnableSwipingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
IsTextVisibleProperty
Identifies the IsTextVisible bindable property. The value enables or disables the default text of all rotator items.
Declaration
public static readonly BindableProperty IsTextVisibleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ItemsSourceProperty
collection of items that can be populated as Rotator items and get rendered at run-time based on the Template provided.
Declaration
public static readonly BindableProperty ItemsSourceProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ItemTemplateProperty
Identifies the ItemTemplate bindable property. The instance of the Template class defines visual structure of a rotator item.
Declaration
public static readonly BindableProperty ItemTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
NavigationButtonBackgroundColorProperty
Identifies the SelectedDotColor bindable property. The color to be filled for Selected Dot representation.
Declaration
public static readonly BindableProperty NavigationButtonBackgroundColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
NavigationButtonIconColorProperty
Identifies the UnselectedDotColor bindable property. The color to be filled for UnSelected Dot representation.
Declaration
public static readonly BindableProperty NavigationButtonIconColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
NavigationDelayProperty
Identifies the NavigationDelay bindable property. The value that determines the sliding animation delay when the control in auto play mode.
Declaration
public static readonly BindableProperty NavigationDelayProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
NavigationDirectionProperty
Identifies the NavigationDirection bindable property. The mode is used to slide item either vertically or horizontally.
Declaration
public static readonly BindableProperty NavigationDirectionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
NavigationStripModeProperty
Identifies the NavigationStripMode bindable property. The value determines representation for items either Thambnail or Dots.
Declaration
public static readonly BindableProperty NavigationStripModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
NavigationStripPositionProperty
Identifies the NavigationStripPosition bindable property. The value determines the placement of navigation strip.
Declaration
public static readonly BindableProperty NavigationStripPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
SelectedDotColorProperty
Identifies the SelectedDotColor bindable property. The color to be filled for Selected Dot representation.
Declaration
public static readonly BindableProperty SelectedDotColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
SelectedIndexProperty
Identifies the SelectedIndex bindable property. This property can be used to change the index of selected item.
Declaration
public static readonly BindableProperty SelectedIndexProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
SelectedThumbnailStrokeProperty
Identifies the SelectedDotColor bindable property. The color to be filled for Selected Dot representation.
Declaration
public static readonly BindableProperty SelectedThumbnailStrokeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowNavigationButtonProperty
Identifies the NavigationDelay bindable property. The value that determines the visibility of the navigation button when the control is in thumbnail mode.
Declaration
public static readonly BindableProperty ShowNavigationButtonProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
UnselectedDotColorProperty
Identifies the UnselectedDotColor bindable property. The color to be filled for UnSelected Dot representation.
Declaration
public static readonly BindableProperty UnselectedDotColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
UnselectedThumbnailStrokeProperty
Identifies the UnselectedDotColor bindable property. The color to be filled for UnSelected Dot representation.
Declaration
public static readonly BindableProperty UnselectedThumbnailStrokeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
Command
Gets or sets the value of the Command. It invokes when the button is activated. It is a bindale property.
Declaration
public ICommand Command { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | The command. |
Examples
SfRotator rotator = new SfRotator();
rotator.Command = new Command(() => { DisplayAlert("Message", "SfRotator Command is invoked", "Ok"); });
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
CommandParameter
Gets or sets the value of the CommandParameter, which is a parameter to pass the Command property. This is a bindable property.
Declaration
public object CommandParameter { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The command parameter. |
Examples
SfRotator rotator = new SfRotator();
rotator.Command = new Command<string>((string str) => { DisplayAlert("Message", str, "Ok"); });
rotator.CommandParameter = "SfRotator Command Parameter";
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
DotPlacement
Gets or sets a value that determines the placement of Dots representation in PlatformRotator.
Declaration
public DotsPlacement DotPlacement { get; set; }
Property Value
Type |
---|
DotsPlacement |
Examples
SfRotator rotator = new SfRotator();
rotator.DotPlacement = DotsPlacement.Outside;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
DotsStroke
Gets or sets the value of DotsStroke. This property can be used to change the border color of Dots representation.
Declaration
public Color DotsStroke { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
Examples
SfRotator rotator = new SfRotator();
rotator.DotsStroke = Colors.Black;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
EnableAutoPlay
Gets or sets a value indicating whether gets or sets a Boolean value that indicates whether to enable or disable auto sliding of the items.
Declaration
public bool EnableAutoPlay { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
SfRotator rotator = new SfRotator();
rotator.EnableAutoPlay = true;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
EnableLooping
Gets or sets a value indicating whether gets or sets a Boolean value that indicates whether to enable or disable the cyclic sliding behavior when selection reaches the last item.
Declaration
public bool EnableLooping { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
SfRotator rotator = new SfRotator();
rotator.EnableLooping = true;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
EnableSwiping
Gets or sets a value indicating whether gets or sets a Boolean value that indicates whether to enable or disable swipe touch gesture in the SfRotator control.
Declaration
public bool EnableSwiping { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
SfRotator rotator = new SfRotator();
rotator.EnableSwiping = true;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
IsTextVisible
Gets or sets a value indicating whether gets or sets a Boolean value that indicates whether to enable or disable the default text of all rotator items.
Declaration
public bool IsTextVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
SfRotator rotator = new SfRotator();
rotator.IsTextVisible = true;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
ItemsSource
Gets or sets a collection of items that can be populated as rotator items and rendered at run-time based on the Template provided.
Declaration
public IEnumerable<object> ItemsSource { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | The items source. |
Examples
SfRotator rotator = new SfRotator();
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
ItemTemplate
Gets or sets the value of ItemTemplate. It is an instance of the Template class that defines visual structure of a rotator item.
Declaration
public DataTemplate ItemTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DataTemplate | The item template. |
Examples
public partial class MainPage : ContentPage
{
public MainPage()
{
SfRotator rotator = new SfRotator();
rotator.ItemsSource = new ObservableCollection<RotatorModel>()
{
new RotatorModel("image1.png"),
new RotatorModel("image2.png"),
};
rotator.ItemTemplate = new DataTemplate(()=>
{
Image image = new Image();
image.SetBinding(Image.SourceProperty,"Image");
return new ViewCell { View = image };
});
this.Content = rotator;
}
}
public class RotatorModel
{
public string Image { get; set; }
public RotatorModel(string image)
{
Image = image;
}
}
NavigationButtonBackgroundColor
Gets or sets the value of NavigationButtonBackgroundColor.
Declaration
public Color NavigationButtonBackgroundColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
Examples
SfRotator rotator = new SfRotator();
rotator.NavigationButtonBackgroundColor = Colors.Lightgray;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
NavigationButtonIconColor
Gets or sets the value of NavigationButtonIconColor.
Declaration
public Color NavigationButtonIconColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
Examples
SfRotator rotator = new SfRotator();
rotator.NavigationButtonIconColor = Colors.Black;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
NavigationDelay
Gets or sets the value that determines the sliding animation delay when the control in auto play mode.
Declaration
public int NavigationDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The navigation delay. |
Examples
SfRotator rotator = new SfRotator();
rotator.NavigationDelay = 2000;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
NavigationDirection
Gets or sets the value of NavigationDirection. This mode is used to slide the item either vertically or horizontally.
Declaration
public NavigationDirection NavigationDirection { get; set; }
Property Value
Type | Description |
---|---|
NavigationDirection | The navigation direction. |
Examples
SfRotator rotator = new SfRotator();
rotator.NavigationDirection = NavigationDirection.Vertical;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
NavigationStripMode
Gets or sets a value of NavigationStripMode. It determines representation for items either Thumbnail or Dots.
Declaration
public NavigationStripMode NavigationStripMode { get; set; }
Property Value
Type | Description |
---|---|
NavigationStripMode | The navigation strip mode. |
Examples
SfRotator rotator = new SfRotator();
rotator.NavigationStripMode = NavigationStripMode.Dots;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
NavigationStripPosition
Gets or sets a value of NavigationStripPosition that determines the placement of navigation strip.
Declaration
public NavigationStripPosition NavigationStripPosition { get; set; }
Property Value
Type | Description |
---|---|
NavigationStripPosition | The navigation strip position. |
Examples
SfRotator rotator = new SfRotator();
rotator.NavigationStripPosition = NavigationStripPosition.Left;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
SelectedDotColor
Gets or sets the value of SelectedDotColor. It is a color to be filled for Selected Dot representation.
Declaration
public Color SelectedDotColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
Examples
SfRotator rotator = new SfRotator();
rotator.SelectedDotColor = Colors.DarkGray;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
SelectedIndex
Gets or sets the value of SelectedIndex. This property can be used to change the index of selected item.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the selected. |
Examples
SfRotator rotator = new SfRotator();
rotator.SelectedIndex = 1;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
SelectedThumbnailStroke
Gets or sets the value of SelectedThumbnailStroke.
Declaration
public Color SelectedThumbnailStroke { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
Examples
SfRotator rotator = new SfRotator();
rotator.SelectedThumbnailStroke = Colors.Blue;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
ShowNavigationButton
Gets or sets the value that determines the sliding animation delay when the control in auto play mode.
Declaration
public bool ShowNavigationButton { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The navigation delay. |
Examples
SfRotator rotator = new SfRotator();
rotator.ShowNavigationButton = true;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
UnselectedDotColor
Gets or sets the value of UnselectedDotColor. It is a color to be filled for UnSelected Dot representation.
Declaration
public Color UnselectedDotColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
Examples
SfRotator rotator = new SfRotator();
rotator.UnselectedDotColor = Colors.Lightgray;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
UnselectedThumbnailStroke
Gets or sets the value of UnselectedThumbnailStroke.
Declaration
public Color UnselectedThumbnailStroke { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
Examples
SfRotator rotator = new SfRotator();
rotator.UnselectedThumbnailStroke = Colors.Lightgray;
rotator.ItemsSource = new ObservableCollection<SfRotatorItem>()
{
new SfRotatorItem() { Image = "image1.png"},
new SfRotatorItem() { Image = "image2.png"},
};
this.Content = rotator;
Methods
MeasureOverride(Double, Double)
This method is called during the measure pass of a layout cycle to get the desired size of an element.
Declaration
protected override Size MeasureOverride(double widthConstraint, double heightConstraint)
Parameters
Type | Name | Description |
---|---|---|
System.Double | widthConstraint | The available width for the element to use. |
System.Double | heightConstraint | The available height for the element to use. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | The return value. |
Next()
Method to move next item.
Declaration
public void Next()
OnSizeAllocated(Double, Double)
Perform custom layout logic when the size of a visual element changes.
Declaration
protected override void OnSizeAllocated(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | |
System.Double | height |
Previous()
Method to move previous item.
Declaration
public void Previous()
Refresh()
Refresh thumbnail view.
Declaration
public void Refresh()
Events
ItemTapped
This event occurs when tab header item tapped in SfRotator
Declaration
public event EventHandler<EventArgs> ItemTapped
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
SelectedIndexChanged
Selection changed event.
Declaration
public event EventHandler<SelectedIndexChangedEventArgs> SelectedIndexChanged
Event Type
Type |
---|
System.EventHandler<SelectedIndexChangedEventArgs> |
Explicit Interface Implementations
IRotator.RaiseItemTapped(EventArgs)
Raises the selected index changed.
Declaration
void IRotator.RaiseItemTapped(EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | args | Arguments. |
IRotator.RaiseSelectionChanged(SelectedIndexChangedEventArgs)
Raises the selected index changed.
Declaration
void IRotator.RaiseSelectionChanged(SelectedIndexChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectedIndexChangedEventArgs | args | Arguments. |