WPF中使用ItemTemplate把所有Item都控制为指定大小

<ItemsControl.ItemTemplate>
    <DataTemplate>
        <Viewbox Width="60" Height="60" Stretch="Uniform">
            <ContentControl Content="{Binding}">
            </ContentControl>
        </Viewbox>
    </DataTemplate>
</ItemsControl.ItemTemplate>

使用此种方法,不论放入Items的是什么内容,其大小都会缩放至指定大小。

但是对于使用ItemsControl控件的会有个问题,对于WPF控件ItemTemplate会失效,目前未找到解决方法。

posted @ 2013-03-06 15:48  Kation  阅读(528)  评论(0编辑  收藏  举报