Is there a way to force a WrapPanel to insert a "newline" in WPF?

This works:

<WrapPanel>
    <TextBlock>1</TextBlock>
    <TextBlock>2</TextBlock>
    <TextBlock>3</TextBlock>
    <TextBlock>4</TextBlock>

    <TextBlock Width="10000" Height="0" />

    <TextBlock>5</TextBlock>
    <TextBlock>6</TextBlock>
</WrapPanel>

I have to add though... this is pretty much a hack. You might want to consider using a StackPanel, and inside of that, have a WrapPanel with the items you want to Wrap... Example:

<StackPanel>
    <WrapPanel>
        <TextBlock>1</TextBlock>
        <TextBlock>2</TextBlock>
        <TextBlock>3</TextBlock>
        <TextBlock>4</TextBlock>
    </WrapPanel>
    <WrapPanel>
        <TextBlock>5</TextBlock>
        <TextBlock>6</TextBlock>
    </WrapPanel>
</StackPanel>

Tags:

Wpf