Canvas inside canvas, showing relative absolute positioning : Canvas « Windows Presentation Foundation « VB.Net






Canvas inside canvas, showing relative absolute positioning

Canvas inside canvas, showing relative absolute positioning
      
<Page     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Canvas>
        <Canvas Canvas.Top="100" Canvas.Left="200">
            <Label Canvas.Top="0" Canvas.Left="0" Background="Red">0,0</Label>
            <Label Canvas.Top="0" Canvas.Left="100" Background="Red">0,100</Label>
            <Label Canvas.Left="50" Canvas.Top="50" Background="Red">50,50</Label>
            <Label Canvas.Left="100" Canvas.Top="100" Background="Red">100,100</Label>
            <Label Canvas.Left="0" Canvas.Top="100" Background="Red">0,100</Label>
            <Label Canvas.Top="0" Canvas.Left="0">0,0</Label>
            <Label Canvas.Top="0" Canvas.Left="100">0,100</Label>
            <Label Canvas.Left="50" Canvas.Top="50">50,50</Label>
            <Label Canvas.Left="100" Canvas.Top="100">100,100</Label>
            <Label Canvas.Left="0" Canvas.Top="100">0,100</Label>
        </Canvas>
        <Label Canvas.Top="0" Canvas.Left="0" Background="Red">0,0</Label>
        <Label Canvas.Top="0" Canvas.Left="100" Background="Red">0,100</Label>
        <Label Canvas.Left="50" Canvas.Top="50" Background="Red">50,50</Label>
        <Label Canvas.Left="100" Canvas.Top="100" Background="Red">100,100</Label>
        <Label Canvas.Left="0" Canvas.Top="100" Background="Red">0,100</Label>
        <Label Canvas.Top="0" Canvas.Left="0">0,0</Label>
        <Label Canvas.Top="0" Canvas.Left="100">0,100</Label>
        <Label Canvas.Left="50" Canvas.Top="50">50,50</Label>
        <Label Canvas.Left="100" Canvas.Top="100">100,100</Label>
        <Label Canvas.Left="0" Canvas.Top="100">0,100</Label>
    </Canvas>
</Page>

   
    
    
    
    
    
  








Related examples in the same category

1.Align Button along with Canvas positionAlign Button along with Canvas position
2.Using a Canvas to absolutely position elementsUsing a Canvas to absolutely position elements
3.Simple CanvasSimple Canvas
4.StackPanel Demo and CanvasStackPanel Demo and Canvas
5.Canvas with MinHeight and MinWidthCanvas with MinHeight and MinWidth
6.Draws a Path element within a CanvasDraws a Path element within a Canvas
7.Draws several Line elements within a CanvasDraws several Line elements within a Canvas
8.Draws several Polyline elements within a CanvasDraws several Polyline elements within a Canvas
9.Rectangle with Fill and Canvas positionRectangle with Fill and Canvas position
10.Custom Coordinates by transforming the CanvasCustom Coordinates by transforming the Canvas
11.Draw path on a CanvasDraw path on a Canvas
12.Use Canvas coordinationUse Canvas coordination
13.Use Canvas to layout Buttons and LabelsUse Canvas to layout Buttons and Labels
14.Position UI Elements Using Exact CoordinatesPosition UI Elements Using Exact Coordinates
15.Pixel SnappedPixel Snapped
16.Positioning Rectangle on a CanvasPositioning Rectangle on a Canvas
17.Aligning elements using multiple attached properties of CanvasAligning elements using multiple attached properties of Canvas
18.Layer elements in a Canvas elementLayer elements in a Canvas element
19.Use the four attached properties of the Canvas element: Bottom, Left, Right, and TopUse the four attached properties of the Canvas element: Bottom, Left, Right, and Top
20.Canvas PreviewMouseDown action and MouseDown actionCanvas PreviewMouseDown action and MouseDown action
21.Handles the MouseDown event on the CanvasHandles the MouseDown event on the Canvas
22.StatusBar inside a CanvasStatusBar inside a Canvas
23.Drag Items from a List and Drop Them on a CanvasDrag Items from a List and Drop Them on a Canvas
24.Print Visual(Canvas)Print Visual(Canvas)
25.Get position on a Canvas with Canvas.GetLeftGet position on a Canvas with Canvas.GetLeft
26.Use a Thumb to resize a Canvas control by responding to the DragDelta event.Use a Thumb to resize a Canvas control by responding to the DragDelta event.
27.Canvas Positioning Properties SampleCanvas Positioning Properties Sample
28.Canvas.SetTopCanvas.SetTop
29.Canvas.SetBottomCanvas.SetBottom
30.Canvas.SetRightCanvas.SetRight
31.Add buttons to a Canvas with codeAdd buttons to a Canvas with code
32.Set control position for CanvasSet control position for Canvas