我希望有人可以帮助我解决我的ItemsControl问题:)
我使用 aItemsControl作为Grid在MVVM(以及单元格内容)ItemsPanel中添加/删除的一个,Column/RowDefinitions这工作正常,但是当我尝试添加一个GridSplitter拆分器时,显示但他不工作。原因是为每个项目ItemsControl添加一个新的......ContentPresenter
当children 属性中的项目是 typeof时,有什么方法可以用ContentPresenterControlGridSplitter替换?TypeSplitterVM
我也在尝试将Splitterson绑定Grid为 anDependencyProperty但是当我使用ItemsPanel它时它不起作用,因为我无法添加Children到Panel...
这是我的代码:
<DataTemplate DataType="{x:Type vm:GridVM}">
<ItemsControl ItemsSource="{Binding Children}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<view:LayoutGridControl Rows="{Binding Rows}" Columns="{Binding Columns}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Grid.Row" Value="{Binding Model.RowIndex}"/>
<Setter Property="Grid.Column" Value="{Binding Model.ColumnIndex}"/>
<Setter Property="Grid.RowSpan" Value="{Binding Model.RowSpan}"/>
<Setter Property="Grid.ColumnSpan" Value="{Binding Model.ColumnSpan}"/>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
</DataTemplate>