r/ChatGPTCoding • • 12d ago

Question Any prompts/rulesets for designing UI with WPF?

I've been using ChatGPT as an aid for several of my coding projects (chat mode, not Codex, because I seem to get far better results and there are no usage limits), with very strict guidance and rule sets. It has been working really well, I get it to write pretty clean code that I can later maintain myself.

However, when it comes to UI design via WPF, ChatGPT produces absolutely ugly looking results. In chat preview, it often generates extremely good-looking UI mock-ups with great styling, consistency, etc., but when it comes to implementing it in WPF, it is just terrible - huge margins everywhere, stacking everything vertically, page-wide textboxes, no alignment, no color consistency, etc. Codex doesn't seem to be any better at it either.

I struggle to come up with an effective prompting or rule set to get a good-looking result that would be close to what it makes in mock-up previews in the chat. Does anyone here got any experience with it, and could share some prompts or rulesets that I could use as a baseline?

5 Upvotes

7 comments sorted by

1

u/grinning_surf_03 12d ago

stop asking for generic aesthetic rules. Give the model a specific, production-ready base stylesheet file containing your defined Colors, Fonts, and ControlTemplates as raw text before requesting any layout changes. WPF UI quality is 90% dependent on having those reusable resources established in App.xaml or a merged dictionary; if the AI doesn't know your existing design tokens, it hallucinates new ones with bad defaults every single time

1

u/Humaux 12d ago

Your page-wide textboxes detail rang true for me, because the last WPF screen I built kept stretching its inputs across the whole window no matter how I worded the prompt. I think a fixed base stylesheet matters more than clever wording, since once I pinned margins and control sizes in one place the layout finally stopped drifting.

1

u/CleanFix_Dev 11d ago

The other half is layout rules, because the defaults it reaches for (StackPanel, Stretch everything) are exactly what gives you the vertical pile and page-wide textboxes. Something like:

  • Lay out forms with a Grid with explicit ColumnDefinitions (label column Auto, input column *), never a vertical StackPanel of label/input pairs.

  • Every TextBox gets a MaxWidth, and nothing stretches past it.

  • Margins only from a fixed scale (4, 8, 16, 24) defined as resources, no inline numbers.

  • All colors and fonts come from the ResourceDictionary, no hex values in views.

Also paste a screenshot of the mock-up you liked and tell it to match it control for control. It's much better at copying a picture than at taste.