Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is short overview of my xaml structure, and I cant figure out how to have 2 ItemsControl from 2 different bindings inside one DataTemplate and Border for both Rows inside Grid.

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ItemsControl Grid.Row="0" x:Name="AdditionalInfoControl" ItemsSource="{Binding VisibilityCollection}" Grid.ColumnSpan="2">
<DataTemplate>
<Border BorderBrush="DimGray" CornerRadius="8,8,8,8" BorderThickness="2,2,2,2" Margin="5,2,3,3" Background="WhiteSmoke">
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl Grid.Row="1" x:Name="Details" ItemsSource="{Binding DetailsCollection}" Grid.ColumnSpan="2">
<DataTemplate>
<Border BorderBrush="DimGray" CornerRadius="8,8,8,8" BorderThickness="2,2,2,2" Margin="5,2,3,3" Background="WhiteSmoke">
</Border>
</DataTemplate> 
</ItemsControl.ItemTemplate></ItemsControl>
</Grid>


What I have tried:

Code above is what I tried but I dont have idea how to fix this issue.
Posted
Updated 19-Feb-18 2:42am

1 solution

You need another layout panel in between. eg. DataTemplate->Border->StackPanel->ItemsControls
What you mean with "different bindings"? different DataContexts? No your Code doesn't look like this. So I don't get what could be wrong with the bindings - Looks ok To me - just put them together inside the DataTemplate...
 
Share this answer
 
Comments
Member 13568484 19-Feb-18 8:54am    
Maybe I will explain bit better. The problem is that each ItemControl has own border, which instead of giving me one background color WhiteSmoke for each row and each ItemSource, I am having one ItemSource on that background, than there is space and again another same background applied separately. I would like to have both ItemControls on same Border....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900