3

I hope someone can help me with my ItemsControl Problem :)

I use a ItemsControl with a Grid as an ItemsPanel to Add/Remove Column/RowDefinitions in MVVM (and also the Cell Content) this works fine, but when I try to add a GridSplitter the splitter is shown but he doesnt work. The reason is the ItemsControl adds a new ContentPresenter for each item...

Is there any way to replace the ContentPresenter with the GridSplitter Control when the Type of an item in the children property is typeof SplitterVM ??

I'm also trying to bind the Splitters on the Grid as an DependencyProperty but when I use ItemsPanel it doesn't work because I cannot add Children to the Panel...

Here is my code:

<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>
STiLeTT
  • 1,023
  • 10
  • 23
wrld
  • 33
  • 4

0 Answers0