There is a grid grid and a picture in it that automatically scales ( Stretch="Uniform" ). In the same cell is a Canvas with elements. How to make the Canvas have the same total dimensions and the same position as the image (so that they essentially overlap each other).

    1 answer 1

    let's say the Image is called photoTabImage

     <Canvas HorizontalAlignment="{Binding ElementName=photoTabImage, Path=HorizontalAlignment}" Height="{Binding ElementName=photoTabImage, Path=Height}" Width="{Binding ElementName=photoTabImage, Path=Width}" Margin="{Binding ElementName=photoTabImage, Path=Margin}" VerticalAlignment="{Binding ElementName=photoTabImage, Path=VerticalAlignment}" /> 

    My answer is from a similar problem.

    • +1, but I would advise ActualWidth , ActualWidth Width may not be specified (and I'm not sure if this will work). - VladD