Wednesday, November 5, 2008

Centering Content in Xaml

so the other day i was trying to get some content to be dynamically centered. i noticed that the normal way i did it in beta 2 was not working... but that is what i get for using things in beta. i found a few convoluted ways to do it but found that the center align stuff on grid exists now and not only that but it works... here is what it looks like for my grid to take up' the whole area and my set size canvas to be centered on screen:
<usercontrol class="" xmlns="" x="" uc="" >

<grid name="LayoutRoot" >

<grid name="ContentArea" verticalalignment="Center" horizontalalignment="Center" >

<canvas width="660" height="300" >


nice and simple and clean and you don't even have to have a clue what size your UI is. :)