Blogger news

Blogger templates

Tuesday, February 8, 2011

Windows 7 mobile- Content Grid of MainPage.xaml

If you don’t have basic idea about “MainPage.xaml” of windows mobile applications please click here to read my post on basics.

This post is all about the layout inside XAML. Content panel is the area where applications are displayed in windows mobile emulator . Let us see the layout of content panel,

Please click the image to expand,

See the Textblock's are aligned in different positions, left, top,right,center etc.

when we run the application it is displaying in phone emulator as,

Please click image to expand

HorizontalAlignment and VerticalAlignment properties are very important in the layout system in Silverlight. So is Margin. Try adding a Margin setting to the first TextBlock in this program:

VerticalAlignment="Top"

HorizontalAlignment="Left"

Margin="100" />

Now there’s a 100-pixel space between the TextBlock and the left and top edges of the client area.

Margin properties are similar to HTML.

TextBlock also has a Padding property:

VerticalAlignment="Top"

HorizontalAlignment="Left"

Padding="100 200" />

Padding is also of type Thickness, and when used with the TextBlock, Padding is visually indistinguishable from Margin. Margin is space on the outside of the TextBlock; Padding is space inside the TextBlock not occupied by the text itself.

The Margin property is defined by FrameworkElement.

UI elements like width,height etc are same as normal HTML.

No comments:

Post a Comment