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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:07:00+00:00 2026-06-03T11:07:00+00:00

I just started using Caliburn.Micro and I’ve noticed in all the examples that the

  • 0

I just started using Caliburn.Micro and I’ve noticed in all the examples that the methods are all public. I decided to test this by adding a button with:

x:Name="CloseMainWindow"

In my VM I added a method:

private void CloseMainWindow()
{
  TryClose();
}

When I click the button, nothing happens and I don’t hit the breakpoint, but if I change the method to public it works.
I can’t see this being the best way to do this.

Would creating ICommand properties for all the methods be an acceptable solution?

Edit: I just read the answer to the question immediately above, there is not and never will be ICommands in Caliburn.Micro. So my original question still needs an answer, why does everything have to be public in the VM and is this safe?

  • 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-06-03T11:07:02+00:00Added an answer on June 3, 2026 at 11:07 am

    I don’t know what you mean by “is this safe?”. Safer than what?

    Anyway, Caliburn.Micro could have been designed to allow its conventions to bind to private methods, but that has a couple of drawbacks. First, it wouldn’t work in partial-trust environments, like Silverlight or XBAPs or sandboxed plugins. You need full trust to use Reflection to access private members, and Caliburn.Micro is designed to be able to run in partial-trust (it does support Silverlight, after all).

    But a bigger reason is that it would violate encapsulation. These are methods that you intend to be called from outside the class. (The view is a separate class, after all; you’d have to make the viewmodel method public if you were wiring it up yourself in the code-behind.) There’s a word for “I intend to call this from outside my own class” in the language specification, and that’s public. If you set up some magic that calls private methods from outside the class, you’re violating both encapsulation and the Principle of Least Astonishment, because that’s not what private means.

    If you really want to be able to bind to private methods, you can customize the conventions. But it would make your code much harder to understand, so I wouldn’t recommend it unless you can come up with a really good justification.

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

Sidebar

Related Questions

I just started using Qt and noticed that all the example class definitions have
I just started using Qt and noticed that in each example code folder there
I just started using Qt and noticed that it uses its own make tool,
Just started using Java (for Android, if that matters) and all I want is
I just started using the MVCContrib grid in a test project. I'm having a
I just started using Solrnet in my application only to discover that using the
I just started using java so sorry if this question's answer is obvious. I
I just started using the Eclipse IDE and for a first test I created
I just started using Maven and I read that plugins are additional components that
Just started using this technique and am having strange results on the PC side.

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.