Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6198607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:02:55+00:00 2026-05-24T04:02:55+00:00

I am recreating a small app in WPF and I am trying to use

  • 0

I am recreating a small app in WPF and I am trying to use MVVM where it makes sense. I started out thinking I would use it 100% of the time, and so far I have, but I’ve come to the conclusion that strict MVVM (no code-behind whatsoever) is not necessarily a positive thing.

Now I am trying to make a user control that will bind to a list and create a regular button for every item in the list. (Essentially I’m recreating a list-box but with a different style.) I am making this user control specifically to avoid creating the buttons on the fly in the main window’s code-behind, but I am thinking that since everything is essentially “view”, and all logic will be done elsewhere, I can just add the buttons in the code behind without technically breaking MVVM. Is this line of thinking correct, deeply flawed or somewhere in between? Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:02:56+00:00Added an answer on May 24, 2026 at 4:02 am

    strict MVVM (no code-behind whatsoever)

    MVVM doesn’t forbid the use of code-behind… sometimes code-behind is the right place to do something, as long as it’s purely UI-related.

    However in that case I don’t see the benefit of creating those buttons in code-behind, when you can easily make an ItemsControl with an ItemTemplate that will display buttons for each item in your collection.

    <ItemsControl ItemsSource="{Binding YourCollection}">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Button Content="{Binding Text}" Command="{Binding DoSomethingCommand}" />
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

a quick hand would be much appreciated. I'm trying to make a small algorithm
We're creating a new consumer/public-facing ASP.Net web app. There are two concerns: --Use cookie
I am trying to write a small AppleScript that can output a string of
Currently, I'm opening a database connection in my app's initialization. It's a fairly small
I wanted to do a small loader animation to put in my app. I
I just started to using sass/scss and i have a small issue. Let's assume
A while ago I created a small cardgame web app for fun. The player
I have a small program that which is confusing me. I am trying using
I'm still somewhat new to WPF (only done a few small projects with it).
Hi I am trying architect a small project. I planning to have Data acess,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.