Reputation: 5846
On windows phone 8, i have a page that has the following XAML
<ScrollViewer Grid.Row="1">
<ItemsControl Name="Items1" >
<ItemsControl.ItemTemplate>
<DataTemplate x:Name="DataTemp">
<Grid Margin="0,10,0,0" Height="380">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding img.path}" VerticalAlignment="Top" Margin="10,0" />
<ScrollViewer Name="Vinhos" Grid.Column="1" Background="#7FE00E0E" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
<ItemsControl x:Name="Items2">
<Image Source="img.png" Height="400" />
</ItemsControl>
</ScrollViewer>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
I set the ItemsSource of the first ItemsControl with a list of objects of this type
public class Familia
{
public string nome { get; set; }
public Imagem img { get; set; }
public List<Produto> listaProdutos { get; set; }
}
Like so, Items1.ItemsSource = fams.listaFamilias;
What i want to do is to get the ItemsSource of the second ItemsControl, named "Items2" with the List from the object that is being used in the first ItemsControl named "Items1"
Upvotes: 0
Views: 116
Reputation: 9214
Try this declaration of Items2
:
<ItemsControl x:Name="Items2" ItemsSource="{Binding ItemsSource, ElementName=Items1}">
Upvotes: 1