Using the Margin & Padding properties in XAML

njsokalski

Well-known member
Joined
Mar 16, 2011
Messages
102
Programming Experience
5-10
I have been developing web applications using ASP.NET for a long time, and have plenty of experience with HTML & CSS. However, I am relatively new to Silverlight, XAML, and Windows Phone 7 Apps. I feel I have figured out a reasonable amount of the layout markup in XAML, except for one thing: the Margin & Padding attributes. In developing Windows Phone 7 Apps (or software for any touch-screen device), visual appearance's relation to what is actually part of what element is extra important, because where and what you touch is a big part of triggering events, so you want it to look like what the user is touching is what the app labels it as touching. When doing my layouts in my Windows Phone 7 Apps, I have noticed that in many cases the only way (at least thet I have found) to shift many elements is by using the Margin attribute, both positive and/or negative. However, I have also noticed that in many cases this can cause the touchable area to change, often to an unwanted area, which can sometimes confuse the user, and in cases of apps with slightly smaller elements (I realize that elements should not be too small), almost impossible to use because the whole touchable are is outside of the intended area. And although the Padding attribute has much less of an effect on where and what is touchable, it often will not accomplish the desired visual change (if it is a property of the element at all). Can somebody please give me some guidance on when to use Margin and/or Padding, and what some of the other common techniques are for shifting the position of and removing space around elements in XAML for Windows Phone 7 Apps are? Thank you.
 
Back
Top