views:

147

answers:

2

newbie question, please forgive...

I'm developing a Wpf UserControl that will eventually be bound to a business object. The usercontrol is little more than a series of laid out TextBlocks, and perhaps (later) an image or two.

As I'm laying out the usercontrol, I can put dummy text into all the TextBlocks so I can see what the usercontrol will look like, but as soon as I change the text property to contain the Binding information:

<TextBlock Margin="0,12.8,42,0" Name="lblLastName" 
       FontSize="8" Height="19" 
       VerticalAlignment="Top" 
       Text="{Binding Mode=OneWay, Path=LastName}"/>

Then I can no longer see the textbox, or any "placeholder" text. This makes it very difficult to adjust the location and sizes of all the controls on the UserControl. In WinFormas programming, you could set binding information independently of the Text property, so you could at least see the Placeholder text during design time development. It's going to be pretty hard to visually arrange a bunch of invisible TextBlocks! What's the standard solution for this?

A: 

I have successfully used design time mock objects to get a good preview of what everything will look like:

Viewing Design Time Data in Visual Studio 2008 Cider Designer in WPF and Silverlight Projects

Alan Jackson
A: 

You can change the Background of the TextBlock to something visible enough if it's the same color as the visuals behind it, and set HorizontalAlignment to "Stretch". This way it will fill the available width. That, or set the MinWidth to an explicit number. No text, but it will be visible.

kek444