WPF Rectangle.Fill VisualBrush Visual Binding to another control

<StackPanel Margin="40">
    <TextBox x:Name="tbx"
             Height="100"
             FontSize="30"
             TextWrapping="Wrap"
             Background="LightCyan"/>
    <Rectangle Height="{Binding ElementName=tbx,Path=ActualHeight}"
               Width="{Binding ElementName=tbx,Path=ActualWidth}">
        <Rectangle.Fill>
            <VisualBrush Visual="{Binding ElementName=tbx}"/>
        </Rectangle.Fill>
        <Rectangle.LayoutTransform>
            <ScaleTransform ScaleY="-0.75"/>
        </Rectangle.LayoutTransform>
    </Rectangle>
</StackPanel>

 

posted @ 2024-12-24 22:04  FredGrit  阅读(21)  评论(0)    收藏  举报