0

I'm developing a WPF application for a client. The application needs to prompt the user at the start of a production run to populate a number of fields. The data the user is prompted to enter is dependent on the type of product associated with the production run. So for example, Product A may require the user to enter an expiry number, lot number while Product B may require the user to enter a manufacturing date only.

I will need to dynamically create the UI and display the name of the field, the input control (text box, list box, checkbox etc) .

The system needs to be flexible and a mechanism to allow the user "create" the dynamic UI layout needs to be put in place.

I'm looking at various options, such as:

  1. XML to declare the ui structure the user would like. The app would then process the XML and create apprropriate ui controls for the various XML elements

  2. A custom DSL which would allow the user to enter something like:

    "create textbox for field LOT NUMBER"

    Like the xml approach, the app will save the above and assign it to a Product and save it in the DB. During the start of the production run the app dynamically creates the UI.

Initially the user will edit these files by hand and assign them to a product. Eventually we plan to have a graphical front end for designing the UI with drag and drop support.

I don't have much experience with DSLs. Just wondering if the above is a suitable application for DSLs or if I should take a completely different approach.

1 Answer 1

1

Microsoft offers the Visualization and Modeling SDK, formerly known as the DSL Toolkit.

This includes a graphical designer for creating your DSL. The output of the designer is

  1. a DSL designer (graphical, by default) which can be used to create instances of your model from inside of Visual Studio.
  2. An API for manipulating your model at runtime
  3. The ability to produce text-based artifacts from a model instance

An example would be that you would create a DSL instance for a particular product type which might say that the product type requires the input of a part number, a color, and an expiration date. When you save the model instance, it would automatically generate your .xaml file for a user control containing a text box for the part number, a color picker for the color, and a date picker for the expiration date.

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

1 Comment

I haven't had an opportunity to check the SDK out but will report back when I do. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.