New to Telerik UI for WPF? Download free 30-day trial

Getting Started with WPF SlideView

This tutorial will walk you through the creation of a sample application that contains a RadSlideView control.

Assembly References

To use RadSlideView, add a reference to the following assembly:

  • Telerik.Windows.Controls

Defining the RadSlideView

You can add RadSlideView manually in XAML as demonstrated in the following example:

Adding RadSlideView in XAML

Empty RadSlideView

WPF Empty RadSlideView

Data Binding

RadSlideView allows you to data bind it to a collection of business objects. To do so, bind the collection to the ItemsSource property of the control.

The following example will demonstrate a simple data binding scenario.

Defining the model

public class Photo 
    public string Title { get; set; } 
    public string ImagePath { get; set; } 
Public Class Photo 
    Public Property Title As String 
    Public Property ImagePath As String 
End Class 

Defining the view model

public class PhotosViewModel 
    public PhotosViewModel() 
        this.Photos = new ObservableCollection<Photo>() 
            new Photo() { Title = "First Photo", ImagePath = "FirstPhoto.png" }, 
            new Photo() { Title = "Second Photo", ImagePath = "SecondPhoto.png" }, 
            new Photo() { Title = "Third Photo", ImagePath = "ThirdPhoto.png" }, 
    public ObservableCollection<Photo> Photos { get; set; }  
Public Class PhotosViewModel 
    Public Sub New() 
        Me.Photos = New ObservableCollection(Of Photo)() From { 
            New Photo() With { 
                .Title = "First Photo", 
                .ImagePath = "FirstPhoto.png" 
            New Photo() With { 
                .Title = "Second Photo", 
                .ImagePath = "SecondPhoto.png" 
            New Photo() With { 
                .Title = "Third Photo", 
                .ImagePath = "ThirdPhoto.png" 
    End Sub 
    Public Property Photos As ObservableCollection(Of Photo) 
End Class 

Binding the collection to the ItemsSource property

        <local:PhotosViewModel x:Key="PhotosViewModel"/> 
    <telerik:RadSlideView DataContext="{StaticResource PhotosViewModel}" 
                          ItemsSource="{Binding Photos}"> 

Customizing the appearance of the bound items via the ItemTemplate property of RadSlideView

        <local:PhotosViewModel x:Key="PhotosViewModel"/> 
    <telerik:RadSlideView DataContext="{StaticResource PhotosViewModel}" 
                          ItemsSource="{Binding Photos}" 
                        <RowDefinition Height="Auto"/> 
                        <RowDefinition Height="*"/> 
                    <TextBlock Text="{Binding Title}" 
                    <Image Source="{Binding ImagePath}" Grid.Row="1"/> 
RadSlideView in a sample data-binding scenario

WPF RadSlideView in a sample data-binding scenario

Setting a Theme

The controls from our suite support different themes. You can see how to apply a theme different than the default one in the Setting a Theme help article.

Changing the theme using implicit styles will affect all controls that have styles defined in the merged resource dictionaries. This is applicable only for the controls in the scope in which the resources are merged.

  • Choose between the themes and add reference to the corresponding theme assembly (ex: Telerik.Windows.Themes.Windows8.dll). You can see the different themes applied in the Theming examples from our WPF Controls Examples application.

  • Merge the ResourceDictionaries with the namespace required for the controls that you are using from the theme assembly. For the RadSlideView, you will need to merge the following resources:

    • Telerik.Windows.Controls

The following example demonstrates how to merge the ResourceDictionaries so that they are applied globally for the entire application.

Merge the ResourceDictionaries

            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml"/> 
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/> 

Alternatively, you can use the theme of the control via the StyleManager.

The following image shows a RadSlideView with the Windows8 theme applied.

RadSlideView with the Windows8 theme

WPF RadSlideView with the Windows8 theme

Telerik UI for WPF Learning Resources

See Also

In this article