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 6144849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:42:31+00:00 2026-05-23T18:42:31+00:00

I’m working on a throwaway application, but I like to use these as a

  • 0

I’m working on a throwaway application, but I like to use these as a chance to sharpen my skills with unfamiliar things. So I decided to use MVVM and WPF instead of sticking to my WinForms comfort zone. I can’t figure out how to make some pieces of my UI talk to each other. Well, it’s more like I can’t find a way to do it that doesn’t seem wonky.

The application’s testing performance of an algorithm for determining the minimum/maximum of slices out of a large data of collection. Here’s what it looks like.

The main window’s ViewModel generates a collection with many values. I want to specify a range for a slice, then execute several versions of minimum/maximum algorithm to verify correctness and execution time.

The parts in group boxes at the bottom are two instances of a UserControl I’ll call the child controls. This made sense to me because I knew I’d need several and didn’t want to copy/paste clusters in the main window. This is where the trouble occurs.

The main window VM has properties for the collection and the slice range. I need the child VMs to have access to these properties. This is proving difficult. Ideally, I’d want something like this:

<local:AlgorithmTester RangeStart="{Binding RangeStart}"
                       RangeEnd="{Binding RangeEnd}"
                       Values="{Binding Values}" />

The child VMs have their own VM. If I put dependency properties on the control, I have to link those properties to the control’s VM as well, probably through an in-code binding. This seems kind of wonky to me. I’ve thought of the following alternatives, but all seem kind of strange to me:

  1. Don’t use UserControls; copy/paste the code for each tester.
  2. Set up the VMs for the testers in code in such a way that a lambda can capture the needed properties in a closure. (Doing this right now.) This makes me feel dirty as the lambdas should belong in another class.
  3. A Twitter friend suggested an event aggregator. The child VMs would subscribe to a “RangeStartChanged” aggregated event (and others.) I don’t like this because I feel the relationship between child VM and parent VM should be more clear; maybe it’s old habits dying hard?
  4. Instead of a UserControl, use a templated ItemsControl against a class with the appropriate properties. I’d still have to find a way to communicate changes in the main VM properties, but that’d be logic internal to the main VM. The only reason I don’t like this approach is it strikes me as odd; this could be years of WinForms experience holding me back. (The more I think about this one the more I like it.)

Are there other solutions? Am I being too picky about the ones that exist? What would you do?

  • 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-23T18:42:32+00:00Added an answer on May 23, 2026 at 6:42 pm

    I would personally either make them UserControls with dependency properties, and bind them in your main view model as shown. Alternativley, and what I would actually do, is use an MVVM framework such as Caliburn.Micro which makes view composition incredibly easy.

    In Caliburn.Micro’s case, you would have 2 public properties on your main view model, each of type AlgorithmTesterViewModel, and on your main view 2 ContentControl‘s called the same as your 2 public properties.

    Caliburn.Micro will automatically locate the AlgorithmTesterView by naming convention, inject the view into the 2 ContentControl‘s (via DataTemplates behind the scenes), and bind up the controls on each to the properties on the AlgorithmTesterViewModel.

    You would then instantiate the two AlgorithmTesterViewModel‘s in your main view model, passing in the appropriate data, and assign them to the 2 public properties.

    By the way, you look a lot like David Mitchell. That is neither an insult or a complement. Just an observation of fact.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into

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.