Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int tbIndex = 0;
- for (int i = 1; i < 5; i++) {
- StackPanel pan = new StackPanel();
- pan.Orientation = Orientation.Horizontal;
- pan.Margin = new Thickness(3);
- pan.Name = "RowPanel" + i;
- for (int j = 0; j < 3; j++) {
- CheckBox cb = new CheckBox();
- TextBlock block = new TextBlock();
- block.Width = 75;
- block.Text = "Item " + (++tbIndex).ToString();
- pan.Children.Add( cb );
- pan.Children.Add( block );
- }
- ContentPanel.Children.Add( pan );
- }
- <ItemsControl ItemsSource="{Binding YourListOfItems}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal">
- <CheckBox IsChecked="{Binding YourIsChecked}"/>
- <TextBlock Text="{Binding YourText}"/>
- </StackPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- <ItemsControl x:Name="myItems" Width="300">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <controls:WrapPanel x:Name="itemsWrapPanel" Margin="0" Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" Width="100">
- <CheckBox IsChecked="{Binding MyCheckedProperty, Mode=TwoWay}" x:Name="IsSelectedCheckBox" Height="25"></CheckBox>
- <TextBlock Height="12" Text="{Binding MyTextProperty}" Margin="0" />
- </StackPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
Add Comment
Please, Sign In to add comment