Silverlight layout hack: Centered content with fixed maxwidth

 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 =)

No Comments