Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Multiline DataFormTextField?
7 replies. Latest Post by StefanOlson on July 21, 2009.
(0)
StefanOlson
Member
215 points
90 Posts
06-30-2009 1:52 AM |
How can I make a DataFormTextField multiline? I've tried to apply a style like this:
<
</
in the following way:
but it looks absolutely no different than if I hadn't applied the style.
Does anyone have any ideas on how to get it to be multiline?
...Stefan
TomBeeby
Participant
1151 points
188 Posts
07-06-2009 10:34 AM |
try using a DataFormTemplateField rather than a DataFormTextField.
here's a good post:
http://www.silverlightshow.net/items/Creating-Rich-Data-Forms-in-Silverlight-3-Customization.aspx
07-06-2009 4:18 PM |
TomBeeby: try using a DataFormTemplateField rather than a DataFormTextField. here's a good post: http://www.silverlightshow.net/items/Creating-Rich-Data-Forms-in-Silverlight-3-Customization.aspx
Unfortunately that has an additional problem, in that the field label doesn't pick up the binding and display itself in bold. I have a separate post about that, but thus far don't have an answer:
http://silverlight.net/forums/t/105016.aspx
xifan
24 points
27 Posts
07-07-2009 12:54 AM |
Why not use TextBox ?
07-07-2009 1:25 AM |
xifan: Why not use TextBox ?
As I said above the field label style doesn't get correctly updated based on the validation properties of the object we're binding to.
In any case, applying a style should work. I'm assuming it's a bug in Silverlight 3 that will be fixed by RTW.
07-07-2009 1:41 AM |
I see what you mean Stefan - DataFormTemplateField doesn't have the Binding property - so it can't be linked to a property and inherit from metadata - so the FieldLabelContent isn't populated from metadata, and in the instance that it is a required field, it isn't automatically bold.
I will shortly encounter this problem so I'm hoping that either:
1. there is an obvious answer we are missing
2. it is - as you say - a bug that will be fixed in SL3
07-07-2009 9:02 PM |
Tom,
There a couple of issues here, the first one is the can't apply a style to a DataFormBoundField, and I believe this is a bug should be fixed in Silverlight 3.
The second issue, which is the one you are referring to is the fact that the field label has no idea what we are binding to when you use a template field. I'm not so confident, given my lack of success in the other thread that there will be any sort of solution for this in Silverlight 3. The good news I suppose it is that there is source code available for the data form so we could possibly create something that resolves this problem ourselves.
The way that I've been resolving this in the meantime is that I create my own custom field derived from DataFormBoundField. As you can imagine this is not a trivial piece of work every time you need to make some customization to the field, but it does resolve the second (but not the first) problem in the meantime. Hopefully Silverlight 3 will go to release candidate at the end of this week and will be able to avoid that kind of time-consuming work.
07-21-2009 1:22 AM |
The good news is that this issue is resolved in Silverlight 3 because the whole dataformfield area been restructured.