<XAML>

<Canvas><!--Canvas에서는 좌표가 같을경우 진짜로 두 Contents가 겹쳐있는거다. (다른경우는 앞에껄 빼고 들어간것)-->

<Button Canvas.Left="100" Canvas.Top="50">Btn1</Button> <!--맞춘 방향을 기준으로 Ancher-->

<Button Canvas.Left="200" Canvas.Top="100">Btn2</Button>

</Canvas>


 

 

<C#>

  - XAML

 

<Canvas Name="canvas"></Canvas>

 

 

   - C#

 

Button btn1 = new Button();

btn1.Content = "Btn1";

canvas.Children.Add(btn1);//<canvas>에 넣고

Canvas.SetLeft(btn1, 100);//위치지정

Canvas.SetTop(btn1, 50);

 

Button btn2 = new Button();

btn2.Content = "Btn2";

canvas.Children.Add(btn2);

Canvas.SetLeft(btn2, 200);

Canvas.SetTop(btn2, 100);



by 피요히코~ 2009. 2. 25. 12:51