Silverlight layout hack: Centered content with fixed maxwidth

Posted by brainbox on ASP.net Weblogs See other posts from ASP.net Weblogs or by brainbox
Published on Fri, 02 Apr 2010 16:45:00 GMT Indexed on 2010/04/02 17:03 UTC
Read the original article Hit count: 637

Filed under:
|
|
|

 Today we need to create centered content with fixed maxwidth. It is very easy to implement it for fixed width, but is not clear how to achieve the same for maxwidth.

The solution to the problem is Grid with 3 columns:

<Grid>

      <Grid.ColumnDefenitions>

            <ColumnDefenition Width="0.01*" />

            <ColumnDefenition Width="0.98*" MaxWidth="1280" />

            <ColumnDefenition Width="0.01*" />

      </Grid.ColumnDefenitions>

</Grid>

Huh... like html coding xaml coding is still full of dirty tricks =)

© ASP.net Weblogs or respective owner

Related posts about Silverlight

Related posts about Tips & Tricks