使用拆分器使ItemsControl子级可调整大小 [英] Making ItemsControl childs resizeable with a splitter

查看:73
本文介绍了使用拆分器使ItemsControl子级可调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将小部件插入我的ItemsControl中并使它们可调整大小.我该如何实现?

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

这是我的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>

绑定到:

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?

推荐答案

您应该可以添加装饰器.我会做一个样本,但是我不想.看看这篇文章这是文章

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

这篇关于使用拆分器使ItemsControl子级可调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆