Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit How do I tell the field label for a DataFormTemplateField what I'm binding to?
10 replies. Latest Post by StefanOlson on July 26, 2009.
(0)
StefanOlson
Member
244 points
113 Posts
06-30-2009 12:25 AM |
If I have the following code:
<
</
The data form doesn't automatically pick up the binding and display the field label and bold it appropriately, presumably because it doesn't know that I'm binding to the bond property. How can I tell it this so that it will correctly bold the field label and pull the text for the label out of the bond property?
....Stefan
SLMonster
299 points
65 Posts
07-03-2009 10:02 AM |
you may need to set DataContext to the Dataform
07-06-2009 4:15 PM |
SLMonster: you may need to set DataContext to the Dataform
The current item is set correctly, that is not the problem. It is with the design of the field, there's no way to tell what you're binding to.
...Stefan
Jonathan...
All-Star
24979 points
2,434 Posts
07-07-2009 2:53 AM |
Hi Stefan,
For example,
Please make sure that your DataContext or ItemsSource is ok. You can get a working sample here.
Best regards,
Jonathan
07-07-2009 3:02 AM |
Jonathan,
That does not address my question. The problem is that the field label does not pick up the validation properties of the property that I'm binding to and therefore bold the field label. In the example you have posted off that site none of the items are bold because validation properties not being used.
07-07-2009 3:31 AM |
StefanOlson:The problem is that the field label does not pick up the validation properties of the property that I'm binding to and therefore bold the field label.
Not quite sure about what you want.
StefanOlson:In the example you have posted off that site none of the items are bold because validation properties not being used.
Please take a look at this video tutorial. It shows you how to use validation on DataForm. For the ValidateProperty, please take a look at this article.
07-07-2009 7:47 PM |
Jonathan Shen – MSFT: Not quite sure about what you want.
if a property has the required attribute, e.g:
[
There needs to be a way to tell the field label which property you are binding to so that can appropriately figure out if the attribute is required and bold itself.
07-08-2009 11:33 PM |
I have upgraded my Silverlight Tools to a internal version. Seems DataForm stops working now. Since Silverlight 3 will be released very soon, would you please upgrade it and have a test. If it doesn't work, please open a new thread and share the link with me. Thanks for you understanding.
07-09-2009 12:59 AM |
I'm not quite sure what you would like me to upgrade to, I'm not aware of a later version of Silverlight 3 or the Silverlight 3 tools I can test with. Can you let me know the URL where I can download the latest version? Currently running Silverlight 3.0.4037.0. In Visual Studio (i.e Silverlight 3 tools):
Microsoft Silverlight Projects 2008Version 9.0.30729.4063
Personally, I am very concerned that Silverlight 3 will be released without a release candidate, because there are a number of issues that I am not sure if they've been fixed in the final Silverlight release, and I'm also concerned that additional problems could be introduced.
07-09-2009 3:13 AM |
Hi Stenfan,
Silverlight 3 RTW has not been released yet. Anyway, it will be released very soon.
07-26-2009 6:15 PM |
In the Silverlight 3 RTW the new data field class has a PropertyPath member. This can be set to tell the data field which property you are working with e.g.
<dataform:DataField PropertyPath="Bond"> <StackPanel Orientation="Horizontal"> <TextBlock Text="$" VerticalAlignment="Center"/> <TextBox Text="{Binding Path=Bond}" Width="75"/> </StackPanel></dataform:DataField>