Wednesday, September 26, 2012

How to Set Design Time Sizes and Positions for a Control in Silverlight

How to Set Design Time Sizes and Positions for a Control in Silverlight

I'm wondering if there is a simple way to set the design time sizes and positions for a control in Silverlight.

For example, there is a TextBlock on the canvas which is the LayoutRoot. I want to set the TextBlock's design-time Width, Height, Canvas.Left, and Canvas.Top. (NOTE: the run-time Width, Height, Canvas.Left, and Canvas.Top will be bound with a dynamic property in XAML (not in code).

Answers & Comments...

Answer: 1

You can specify the DesignHeight and DesignWidth properties. But as far as I can tell, the others are not possible.

To get the width and height, make sure the xmlns for the design properties is brought in

xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 

Then, you can use it like so.

<TextBox d:DesignWidth="250" d:DesignHeight="75" /> 

Hope that helps!

by : mw007http://stackoverflow.com/users/1327477




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog