I have a list of strings and I want to convert it to checkboxes control in scrollviewer control. How can I do this? Any ideas? The list consists 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"};
}
}