SL - 整理 - WrapPanel (换行组建)

来源:互联网 发布:软件开发费用预算表 编辑:程序博客网 时间:2024/05/08 17:21
添加引用System.Windows.Controls.Toolkit.dll

<vmNsp:DataListBase x:Class="SilverlightApplication1.Common.DataList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:vmNsp="clr-namespace:SilverlightApplication1.Common"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" x:Name="userControl1">

    <UserControl.DataContext>
        <vmNsp:DataListViewModel x:Name="DataListViewModel1" />
    </UserControl.DataContext>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <ItemsControl x:Name="ListView1" ItemsSource="{Binding Path=Items}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="Black" BorderThickness="0" Width="{Binding Path=DataContext.ItemWidth, ElementName=userControl1}" Height="{Binding Path=DataContext.ItemHeight, ElementName=userControl1}" Child="{Binding Path=Content}">
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <toolkit:WrapPanel HorizontalAlignment="Left"  Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </Grid>
</vmNsp:DataListBase>
0 0
原创粉丝点击