4

I've got a massive UI that I'm designing. The way that my employer wants it, there are at least 100 labels. Now, I've always thought that in cases like this, breaking up the UI into smaller custom controls was the ideal way to go. However, someone recently told me that custom controls are really only for code re-use. What is the actual suggested practice for this?

EDIT

The finished form will look like this:

enter image description here

Now, I'm using WPF for the UI, and I'm thinking of breaking this down into smaller bits.

5
  • what do you mean with "there are at least 100 labels"? Labels are already reusable controls, and a big number of them doesn't mean there is the need of a custom control Commented Sep 3, 2013 at 14:17
  • @RichardEv: I've posted a picture of the UI. There's lots of labels because this is the way that my employer wants it. I was thinking of breaking it down to about 10-14 smaller controls. Commented Sep 3, 2013 at 14:28
  • @Vik: I mean, that the UI would contain "at least 100 labels". In reality, its much much more. Commented Sep 3, 2013 at 14:28
  • 1
    It looks like some sort of grid control might be appropriate... Aside: What on earth is this UI for, and how would someone use it? Commented Sep 3, 2013 at 14:30
  • 1
    @RichardEv: They want this monstrosity to pull information from a database, and display it in the various labels, and then print it out. Commented Sep 3, 2013 at 16:04

5 Answers 5

2
+25

Based on your image i see some repetitions, each of this repetitions could be a custom UserControl

But it depends on the usability is it easier to write a custom UserControl so do it but if it would reduce the readability of your code and it also adds additional complexity don't do it

here are an example of what could be separate UserControl's

the green ones are possible useful encapsulations of logic
the orange ones maybe need some not market stuff (don't know enough about your software)
the red ones are the maybe's based on the intern use (from the visual part they are repetitions so the should custom UserControl)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

Since your UI is read-only, I'd suggest using a grid.

Comments

0

Are you new to WPF? To break the View into bits WPF offers you CustomControls and UserControls. They are two very similar things yet completely different from each other. CustomControls are Buttons, Labels, TextBoxes, DataGrids...etc. They are basically simple stand-alone controls. UserControls are groups of stand-alone controls serving a purpose such as example a Button and a ComboBox next to each other so user can select something in ComboBox and confirm that by clicking the Button.

If you wish to display data from database I suggest you DataGrid which will give you a table-alike look with rows and columns and all that. If you wish to place few buttons next to DataGrid on which the user may click to insert a new row or to edit a certain cell then I suggest you to wrap all that with a UserControl which you can reuse in other places where you have to display and change data from database too.

Comments

0

You should be using a datagrid and can customize its template to render individual cells as Textblock (lighter version of Label) from a rendering perspective. The main difference between Textblock and Label is very minor things such as access keys and disabled state behavior. But from a WPF object hierarchy - Textblocks are much lighter. But besides that point - from your employer perspective - once you have customized the grid template and render them (so as they look as textblocks/labels) - your employer should have no problems.

Also as somebody suggested above - if you want to logically break sections of the UI since they maybe coming from a different table in db - then User controls is the way to go (for maintainability of code)

Let me know if you are looking for more technical details or need help further technically.

Comments

0

There is nothing wrong in making and using custom controls or user controls or defining some data templates which will be reused depending on how your data is organized.

For sure the UI looks pretty messy and some sort of grid should be used with templates for example where there is similar data. I also have the suggestion and first think about the data and the functionality before starting and let the UI be driven by that. For sure you will the reuse controls/templates. If you think in front on the model and behavior the UI can afterwards more easily changed.

Create your viewmodel correctly, implement the functionality in commands, use bindings, after that the UI will come naturally, reuse controls, use several grids, make the UI more user friendly using several regions, tabs, windows or anything that makes the user more comfortable.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.