Home:ALL Converter>Wrapping itemscontrol items in a form

Wrapping itemscontrol items in a form

Ask Time:2016-02-05T21:03:47         Author:user1914725

Json Formatter

Currently i have a form with this layout

Label:TextBox

Label:TextBox

.............

I have to change the layout to

Label:TextBox Label:TextBox

Label:TextBox Label:TextBox

............. .............

By vertical wrapping of items. I have done this before with static items. But the items are in Itemscontrol thanks to the previous coder.

Here is my current code.

<Grid Background="{StaticResource AppWhiteBrush}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="60" />
                            <RowDefinition Height="250"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="75"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
.....................................................................
<StackPanel MaxHeight="350" Orientation="Vertical"      
ScrollViewer.VerticalScrollBarVisibility="Disabled"  VerticalAlignment="Top"   
Grid.Row="1" Grid.Column="0"  Grid.ColumnSpan="2" Visibility="{Binding 
IsEditClick, Converter={StaticResource InverseBoolToVisibilityConverter}}" 
 x:Name="ViewPanel" >
   <StackPanel.Resources>
     <DataTemplate x:Key="ContainerDetailsList">
      <Grid >
                   <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="200"/>
                     <ColumnDefinition Width="*" />
                     </Grid.ColumnDefinitions>
     <Label Grid.Column="0" Style="{StaticResource DetailsItemKey}" 
                 Content="{Binding ItemLabel}">
            </Label>
      <TextBox Grid.Column="1" x:Name="TextItem" Text="{Binding 
       OriginalItemValue, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 
        Style="{StaticResource DetailsItemValue}">
        </TextBox>
            </Grid>
           </DataTemplate>
         </StackPanel.Resources>

     <ItemsControl x:Name="MainContainerDetails"
    Visibility="{Binding DetailsMenuItemViewModel.IsSelected, Converter=
     {StaticResource BoolToVisibilityConverter}}"
      ITEMSOURCE="{Binding ValueItems, UpdateSourceTrigger=PropertyChanged}"
     Style="{StaticResource DetailsItemTemplateControl}"
     ItemTemplate="{StaticResource ContainerDetailsList}" >
       <ItemsControl.ItemsPanel>
              <ItemsPanelTemplate>
            <WrapPanel IsItemsHost="true" Orientation="Vertical" />
                        </ItemsPanelTemplate>
              </ItemsControl.ItemsPanel>
      </ItemsControl>

 </StackPanel>

The items are not wrapping... what am i missing?

Author:user1914725,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/35224979/wrapping-itemscontrol-items-in-a-form
yy