Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 将项目放置在项目控件中的路径上_Wpf_Xaml - Fatal编程技术网

Wpf 将项目放置在项目控件中的路径上

Wpf 将项目放置在项目控件中的路径上,wpf,xaml,Wpf,Xaml,您好,我正在处理WPF应用程序,我需要将项目放置在面板上的U形路径上 因此,我使用以下代码,但它将项目放置在队列中,就像我使用堆栈面板一样。所以,当我不断地向数据源添加元素时,有没有办法将项目放置在预定义的路径上?它们应该放置在预定义的路径上 <ItemsControl Name="icTodoList" Grid.Row="2" ItemsSource="{Binding DocumentsItemsSource}" Width="100" Height="460" >

您好,我正在处理WPF应用程序,我需要将项目放置在面板上的U形路径上

因此,我使用以下代码,但它将项目放置在队列中,就像我使用堆栈面板一样。所以,当我不断地向数据源添加元素时,有没有办法将项目放置在预定义的路径上?它们应该放置在预定义的路径上

<ItemsControl Name="icTodoList" Grid.Row="2"  ItemsSource="{Binding DocumentsItemsSource}"  Width="100" Height="460" >
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button Margin="0" HorizontalAlignment="Center" DataContext="{Binding}" Content="{Binding Path=ItemName}" Height="35" Width="35" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>


我不知道是否有类似的功能,但使用它可以相当容易地实现。您可以创建一个自定义面板,如中所示,并在ItemsPanelTemplate中使用它。