.NET MAUI SlideView Events
When the current item or its index changes, the SlideView control emits the CurrentItemChanged
event. You can handle the event and customize the behavior of the component.
Example
To handle the CurrentItemChanged
event of RadSlideView
:
1. Add the RadSlideView
definition.
<telerik:RadSlideView x:Name="slideView"
ItemsSource="{Binding Views}"
CurrentItemChanged="OnCurrentItemChanged">
<telerik:RadSlideView.ItemTemplate>
<DataTemplate>
<Label Text="{Binding Content}"
TextColor="#007ACC"
HorizontalTextAlignment="Center"
VerticalOptions="CenterAndExpand"/>
</DataTemplate>
</telerik:RadSlideView.ItemTemplate>
</telerik:RadSlideView>
2. Add the event handler.
private void OnCurrentItemChanged(object sender, Telerik.Maui.Controls.SlideView.CurrentItemChangedEventArgs e)
{
App.Current.MainPage.DisplayAlert("Current index changed to", " " + e.NewIndex, "OK");
}
For a runnable example with the SlideView Events scenario, see the SDKBrowser Demo Application and go to SlideView > Events.