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

I'd like to display a repeating event on a date/time display in an app.
I'm still somewhat new to WPF (only done a few small projects with it).
I' building an hobby project in WPF also decided to use Metro style theme
We're creating a WPF custom control targeted at .NET 3.5. It is very compelling
I'm adding repeating events to a Cocoa app I'm working on. I have repeat
We are trying to fill our Flex 3 applications background with an image pattern
I have used Flex for about a year before deciding that I would rather
I am looking for the API calls that would allow loading cookies into IE
I've been banging my head for a long time on this one I am
We're creating a Interaction design pattern website for a class. We've been using google

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.