2

I would like to get my data entry form to be dislayed in mentioned below sample format. Thing is i almost have 40 fields to be displayed. So i would prefer this format and scrollbar too. Can anyone tell me the better way for these many fields in this format. Let me know the sample piece of code so that i can have better clarity..

Using grid I get 4 columns and almost 25 rows. So UI code getting big..

Apart from grid row definitions or any other way.

Sample format:

enter image description here

jv42
  • 8,521
  • 5
  • 40
  • 64
bantu
  • 61
  • 3
  • 10

1 Answers1

2

This sounds like a typical Grid: http://msdn.microsoft.com/en-us/library/system.windows.controls.grid%28v=vs.95%29.aspx

You want to create one ColumnDefinition per column (so either 2 or 4 depending on how you place your labels (TextBlocks) vs your TextBoxes, and one RowDefinition per row.

That might be tedious with so many fields to do it, so you might want to generate it, it really depends on how you get your fields, and if the fields will never change.


Another solution is the Toolkit's DataForm, which looks exactly like what you've shown: http://silverlight.codeplex.com/

You can try the demo to see how it looks. I've never used it, so I can't vouch for its ease of use or power, etc... But at the time of writing, it's in the 'Preview' quality band (see http://silverlight.codeplex.com/wikipage?title=Quality%20Bands&ANCHOR#Preview for explanation).

jv42
  • 8,521
  • 5
  • 40
  • 64
  • thank you so much for your response and answer. yeah..i tried that way but as i am going with the code..4 columns and 25 rows. feel like UI code going huge. so i would like to opt some other way if persists.. – bantu Jun 28 '12 at 16:52
  • If you will have such needs more than once, you could create an UI generator, that would take your Model class and generate a form based on the available properties and their types. – jv42 Jun 29 '12 at 06:33
  • But if your list of properties is fixed, and you don't have other such projects, Grid + StackPanel + DataBinding is the way to go. It will make a quite big XAML, but once done, you won't have to touch it much. – jv42 Jun 29 '12 at 06:35
  • thank you. Further i have many forms to be created. So can you temme about UI generator – bantu Jun 29 '12 at 09:20
  • thank you so much. The link posted is pretty useful. Further too helps out a lot. once i will try out the one you have suggested. – bantu Jun 30 '12 at 04:21