October 22, 2024
Chicago 12, Melborne City, USA
templates

C# Show pre-configured template based on a condition in WPF


So let’s say I have multiple grids laid out, 2 of them are static and will not change, but the third grid, is meant to show elements based on a set of conditions outlined.

If one condition is met, then the third grid should show 2 input boxes. If another is met, 1 input box, 2 combo-boxes (for example, there can be infinite amount of layouts based on conditions).

What should I be looking at to generate pre-set layouts, and only show the relevant ones in the third grid, in a specific location?

I was thinking that easiest way would be to write a class in C# that generates WPF elements in a specific layout, might’ve been the case… but I’ve never done that. The only other thing I can think of is to pre-set some sort of template in WPF’s actual xaml/editor, but I’m also not sure what elements to use for that, or what the ideal elements would be.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video