Steps
- Add a listbox control in to your window
- Declare templet panel of your list
box and add wrap panel in to the template panel, like bellow code
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
- Add the Data Template into the Item
Template of list box and add check box control in to the Data Template,
Bind the date to the display with content of TextBox, see the code
bellow:
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Width="150" Foreground="Black" IsChecked="{Binding Active}" Content="{Binding Path=Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
-
Code bellow is create the Check List box
<ListBox HorizontalAlignment="Left" Height="242" VerticalAlignment="Top" Width="497" Margin="0,44,0,0" ScrollViewer.VerticalScrollBarVisibility="Disabled" x:Name="StudentList">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Width="150" Foreground="Black" IsChecked="{Binding Active}" Content="{Binding Path=Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Join the conversation! Your thoughts help the community grow.