I want to make an array of boxes in the scrollviewer control in WPF

advertisements

I have a list of strings and I want to convert it to checkboxes control in scrollviewer control how ? any ideas ? list consist of courses and I want to make it as checkboxes so student can choose some of them


XAML Part :

   <ScrollViewer>
        <ListBox ItemsSource="{Binding .}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <CheckBox Content="{Binding Path=.}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </ScrollViewer>

Code-behind part :

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        DataContext = new string[] {"course1", "course2"};
    }
}