Windowstemplatestudio: Add codebehind as a framework option for WPF

Created on 3 Jul 2020  路  4Comments  路  Source: microsoft/WindowsTemplateStudio

Add codebehind as a framework option for WPF

Action plan:

  • [x] Add templates
  • [x] Add template tests
  • [x] Update docs
  • [x] Update build pipelines to include codebehind template tests
Can Close Out Soon Generated Code WPF

Most helpful comment

I want a hybrid:

  • Minimal binding (only used when it _significantly_ reduces the amount of code needed)
  • Have events, not commands
  • Use dependency Injection.

Option 1 feels like MVVM but with the ViewModel in the code-behind file.

All 4 comments

We would like to better understand what Devs expect from a project generated with the CodeBehind framework for WPF.

When do you choose CodeBehind? For a quick Proof of Concept? To use you own MVVM framework? Other reasons?

We've prepared two approaches on what we think CodeBehind could look like for WPF at https://github.com/mvegaca/WpfCodeBehindSamples

Option 1 (DataBindingCodeBehindApp):

  • Uses Binding to the Pages CodeBehind file
  • Uses Events instead of Commands
  • Uses Dependency injection using the .NET Generic Host

Option 2 (CodeBehindApp):

  • No use of Binding (except for DataTemplates)
  • Uses Events instead of Commands
  • No Dependency Injection

Would love to hear your comments on what you'd expect for CodeBehind for WPF.
Also, the two options we prepared are just samples. If you expect something else (like DI yes, but no Binding) comment on that too.

I want a hybrid:

  • Minimal binding (only used when it _significantly_ reduces the amount of code needed)
  • Have events, not commands
  • Use dependency Injection.

Option 1 feels like MVVM but with the ViewModel in the code-behind file.

Issues found:
Menubar does not enable back button when navigating to details page of content grid in codebehind

Verified in dev-nightly:
Templates version: 0.22.20267.2
Wizard version: 0.22.20267.2

Was this page helpful?
0 / 5 - 0 ratings