Relate the width and height of the viewport

I need to bind to the width and height property of the viewport. I've tried this:

Viewport="15,15,binding Path=Width ElementName=LayerNormalThumb,binding Path=HeightElementName=LayerNormalThumb"

      

Binding like this worked for me if I only have one property, ex Source = "{binding ...}".

I also tried this:

<VisualBrush.Viewport>
   <Rect X="15" Y="15" Width="{Binding ElementName=LayerNormalThumbnail, Path=Width}" Height="{Binding ElementName=LayerNormalThumbnail, Path=Height}"/>
</VisualBrush.Viewport>

      

which I thought would work, but I get

"Binding" cannot be set on the "Height" property of type "Rect". "Binding" can only be set on a DependencyProperty DependencyObject.

+3


source to share





All Articles