Answered by:
Labels and Display Name

Question
-
I have three labels on a screen. Each are string Data Items I added in order to show some static text. I want to show the text in the label, I do not want to show the Display Name for the label.
How do I accomplish this?
Tuesday, September 20, 2011 3:10 PM
Answers
-
Hi
You can hide label with None Label Position Properties:
Jaime. If you found this post helpful, please: Vote As Helpful. If it answered your question, remember to: Mark As Answer.- Proposed as answer by Spaso Lazarevic Tuesday, September 20, 2011 4:27 PM
- Marked as answer by Justin AndersonMicrosoft employee, Moderator Monday, October 3, 2011 5:48 AM
Tuesday, September 20, 2011 3:38 PM
All replies
-
Hi
You can hide label with None Label Position Properties:
Jaime. If you found this post helpful, please: Vote As Helpful. If it answered your question, remember to: Mark As Answer.- Proposed as answer by Spaso Lazarevic Tuesday, September 20, 2011 4:27 PM
- Marked as answer by Justin AndersonMicrosoft employee, Moderator Monday, October 3, 2011 5:48 AM
Tuesday, September 20, 2011 3:38 PM -
Add a new Silverlight class library project to your solution (or use an existing one if you have one). Right-click the project you added in the solution explorer and go to "Add" -> "New Item...", on the left of the popup window select "Silverlight", and then choose the "Silverlight User Control". Call it "LabelControl", and click "Add". You should get a new window popup with the XAML for your control. Replace the grid section with the following:
<Grid x:Name="LayoutRoot" Background="White"> <TextBlock Text="{Binding Value}" /> </Grid>
In your Lightswitch project, drop your data items onto the screen where you want them. Change their type to a custom control, and then in the properties window click "Change..." to show the list of custom controls available. Add a reference to the project containing your LabelControl if you need to, then select the LabelControl from the list and click OK.
Back in the properties window, set the label position to "None" and horizontal alignment to "Stretch". When you run the project now your data should appear as a read-only label instead of a text box.
EDIT: Mis-read that you were using static data items. If you want to make labels from data source items go ahead and follow what I put.- Edited by Chris.Hart Tuesday, September 20, 2011 3:44 PM Mis-read
Tuesday, September 20, 2011 3:42 PM -
Have a look ay my Luminous Controls extension, it has a TextBlock control to do exactly this kind of "static text".
(plus ça change, plus c'est la même chose!)
If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".
This will help people find the answers that they're looking for more quickly.
- Proposed as answer by Yann DuranModerator Monday, October 3, 2011 5:51 AM
Wednesday, September 21, 2011 12:48 AMModerator