katit
katit

Reputation: 17915

Making ItemsControl childs resizeable with a splitter

I want to insert widgets into my ItemsControl and make them resizeable. How do I achieve this?

This is my XAML:

<ItemsControl ItemsSource="{Binding TestForList, Mode=OneWay}">

    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"                
                        VerticalAlignment="Stretch"                
                        HorizontalAlignment="Stretch" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>

    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <Border Margin="5" 
                    BorderThickness="1" 
                    BorderBrush="Black">
                <TextBlock FontSize="100" Text="{Binding}" />    
            </Border>                    
        </DataTemplate>
    </ItemsControl.ItemTemplate>

</ItemsControl>

Which binds to:

public List<string> TestForList
{
    get
    {
        return new List<string> { "A", "B", "C" };
    }
}

I want to somehow add splitters between items so they can be resized. Is there anything built-in to achieve this?

enter image description here

Upvotes: 5

Views: 280

Answers (2)

Nogusta
Nogusta

Reputation: 919

You should be able to add an adorner. I would do a sample up, but I don't want to. Have a look at this article this be the article

Upvotes: 1

Tim
Tim

Reputation: 15237

I don't think there's anything built-in to do this. My first thought is that you'll need to create your own custom Panel implementation that handles this.

Upvotes: 1

Related Questions