Reputation: 1
I have a Grid
with some Image
s.
I want to make another Grid
that will be copy of this Grid
, 'only smaller'. I want every Image
I will add to the first Grid
will add also to the other Grid
.
If someone can help me.
Upvotes: 0
Views: 624
Reputation: 29594
Use VisualBrush
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UniformGrid Rows="1">
<StackPanel Name="Original" Width="100" Height="100">
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
<TextBlock Text="Pretend I'm a list of images"/>
</StackPanel>
<Rectangle Name="Thumbnail" Width="50" Height="50">
<Rectangle.Fill>
<VisualBrush Visual="{Binding ElementName=Original}"/>
</Rectangle.Fill>
</Rectangle>
</UniformGrid>
</Page>
Upvotes: 0
Reputation: 5689
If you use MVVM you have a binding that drives the first grid's contents. Rebind the second grid to the same data member and it will update to show the same contents even after edits were performed on that collection.
Upvotes: 1