Use the visual brush as a fill on the rectangle.
You wonβt be able to interact with it, though ... but thatβs how the preview thumbnails in the taskbar are executed.
<Grid HorizontalAlignment="Left" Name="A" Height="100" Width="100"> <Grid.Background> <SolidColorBrush Opacity="0" Color="White"/> </Grid.Background> </Grid> <Rectangle Name="RA" VerticalAlignment="Top" Width="100" Height="100" HorizontalAlignment="Left" Stroke="Black"> <Rectangle.Fill> <VisualBrush AutoLayoutContent="True" Visual="{Binding ElementName=A}" ViewboxUnits="RelativeToBoundingBox" ViewportUnits="RelativeToBoundingBox" Stretch="Fill" AlignmentX="Left" AlignmentY="Top" Viewport="0,0,1,1" Viewbox="0,0,1,1" TileMode="None"> </VisualBrush> </Rectangle.Fill> </Rectangle>
To interact, you will have to bind all the properties to the same screen and use the layout transform to compress it.
<StackPanel> <Grid> <TextBox Name="A"/> </Grid> <Grid> <Grid.LayoutTransform> <ScaleTransform CenterX=".5" CenterY=".5" ScaleX=".25" ScaleY=".25"/> </Grid.LayoutTransform> <TextBox Name="B" Text="{Binding ElementName=A, Path=Text, UpdateSourceTrigger=PropertyChanged}"/> </Grid> </StackPanel>
source share