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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:48:45+00:00 2026-05-14T06:48:45+00:00

I’m building a winforms app utilizing passive-view MVP and Castle Windsor as an IoC

  • 0

I’m building a winforms app utilizing passive-view MVP and Castle Windsor as an IoC container. I’m still a little new to dependency injection and MVP, so I’m looking for some clarity…

I have a main form which contains a number of user controls, and also will bring up other dialogs (ex. Login, options, etc) as needed. My first question is…should I use constructor injection to get the presenters for these other views into the main view, or should I go back to a Service Locator-type pattern? (which I’ve been told is a big nono!) Or something else?

Second question…the user controls need to communicate back to the main form when they are “completed” (definition of that state varies based on the control). Is there a standard way of hooking these up? I was thinking perhaps just wiring up events between the main presenter and the child presenters, but I’m not sure if this is proper thinking.

I’d appreciate any help, it seems that the combination of MVP and IoC in winforms isn’t exactly well-documented.

  • 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-14T06:48:45+00:00Added an answer on May 14, 2026 at 6:48 am

    Let me start by saying I didn’t write WinForms in quite some time so I may not be completely accurate.

    If you’re using passive view your views should have no dependencies, so you shouldn’t need to inject anything into them. Presenter should be instantiated by the container and have IView injected into it via .ctor. Generally avoid Service Locator – this post describes some powerful alternatives.

    For communication back, I’d use some kind of bridge-interface, that would be injected into the presenter. I’m vague here, because details depend on specifics of your scenario, and how exactly you decide to partition your logic.

    Generally don’t get too focused on IoC container – it’s just a tool that will do some (big) part of work for you, but it’s not a magic wand – you should be able to do the same thing without the container in place, so if it’s distracting your focus, feel free to remove it from the picture when prototyping.

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

Sidebar

Related Questions

No related questions found

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.