Blog Content

    티스토리 뷰

    07.SilverLight3 - Layout - Canvas

    반응형
    Canvas에 대한 예제입니다.

    MainPage.xaml

    [그림 7-1]


    <Canvas x:Name="redCanvas" Background="Red" Width="100" Height="100">

            <Canvas x:Name="greenCanvas" Background="Green" Width="100" Height="100"

                Canvas.Left="20" Canvas.Top="20">

                <Canvas x:Name="blueCanvas" Background="Blue" Width="100" Height="100"

                    Canvas.Left="20" Canvas.Top="20">               

                </Canvas>

            </Canvas>

    </Canvas>


    Canvas는 직접 지정하여 배치 가능


    ZIndex ( Canvas.ZIndex )

    - ZIndex는 기본값이 "0" 입니다. 숫자가 클 수록 해당 Canvas가 앞으로 보여집니다.
    MainPage.xaml

    [그림 7-2]


    <Canvas x:Name="redCanvas" Background="Red" Width="100" Height="100" Canvas.ZIndex="99">

            <Canvas x:Name="greenCanvas" Background="Green" Canvas.ZIndex="2"

                    Width="100" Height="100" Canvas.Left="20" Canvas.Top="20">

            </Canvas>

            <Canvas x:Name="blueCanvas" Background="Blue" Canvas.ZIndex="1"

                    Width="100" Height="100" Canvas.Left="40" Canvas.Top="40">

            </Canvas>

    </Canvas>



    반응형

    Comments