views:

225

answers:

1

It seems that a won't be visible unless a height and width is specified. Is this true?

This seems rather tedious. Couldn't the bounds of the line imply the correct width and height?

    <Canvas Height="200" Width="200" HorizontalAlignment="Left" Background="Beige">
        <!-- This is visible -->
        <Line X1="20" Y1="40" X2="70" Y2="90"
              Stroke="Black" StrokeThickness="4" Height="100" Width="100" />

        <!-- This is not visible -->
        <Line X1="10" Y1="10" X2="50" Y2="50"
              Stroke="Black" StrokeThickness="4"/>
    </Canvas>

(I'm using Silverlight 3.)

A: 

No, you can use one of this templates to define coordinates:

  1. X1, X2, Y1, Y2
  2. Canvas.Left, Canvas.Top, Width, Height.

If you use them together, CLR may sometimes show your controls wrong.

Manushin Igor