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

  • Home
  • SEARCH
  • 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 9027875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:51:04+00:00 2026-06-16T06:51:04+00:00

I have a WPF application with Caliburn.Micro. The main ViewModel is ShellViewModel. It contains

  • 0

I have a WPF application with Caliburn.Micro. The main ViewModel is ShellViewModel. It contains a tab control, and each tab contains a user control. I need to access a property of ShellViewModel from that internal user control.

var par = ((MyApp.ShellViewModel)((Screen)Parent).MyProperty;

ShellViewModel is not known though. Could you please tell how I can access it?

Thanks.

  • 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-16T06:51:06+00:00Added an answer on June 16, 2026 at 6:51 am

    Ok from your comments it sounds like you have a combobox on the shell which needs to affect what is displayed on one of the tabs.

    To communicate between your ViewModels, you can always use the EventAggregator which is part of CM and implements a subscriber pattern which you can take advantage of

    e.g.

    On your shell VM you can create a static instance of the aggregator or create a separate static class which will provide the aggregator to the application

    static class AggregatorProvider 
    {
        // The event aggregator
        public static EventAggregator Aggregator = new EventAggregator();
    }
    
    class ShellViewModel : Conductor<IScreen>
    {
        // When the combo box selection changes...
        public void SelectionChanged(object SomeValue) 
        {
            // Publish an event to all subscribers
            AggregatorProvider.Aggregator.Publish(new SelectionChangedMessage(SomeValue));
        }
    }
    

    You handle the SelectionChanged of the combobox by using a standard action message or convention (I’m not sure what conventions CM applies by default to the combo so I’ll show the explicit bindings in my example)

    <ComboBox x:Name="MyCombo" cal:Message.Attach="[Event SelectionChanged] = [Action SelectionChanged(MyCombo)" />
    

    Hopefully if the correct conventions are applied, you should get the selected item being passed to the method

    Your child VM just needs to subscribe to the aggregator and implement IHandle where T is the type of message it should handle

    class ChildViewModel : Screen, IHandle<SelectionChangedMessage>
    {
        public ChildViewModel() 
        {
            // Subscribe to the aggregator so we receive messages from it
            AggregatorProvider.Aggregator.Subscribe(this);
        }
    
        // When we receive a SelectionChangedMessage...
        public void Handle(SelectionChangedMessage message) 
        {
            // Do something with the new selection
        }
    }
    

    The SelectionChangedMessage can just be:

    class SelectionChangedMessage 
    {
        public object NewValue { get; private set; }
    
        public SelectionChangedMessage(object newValue) 
        {
            NewValue = newValue;
        }
    }
    

    Obviously the above could be a generic type so that you strongly type the NewValue parameter – then again the message you publish can be anything, so it’s up to you

    It might be worth pointing out that you can Unsubscribe from the aggregator so you can control when it receives notifications. The aggregator uses weak references anyway so you don’t need to worry too much about unsubscribing, but it does mean you have control over when your objects receive messages (i.e. stop listening when the are not active by subscribing on OnActivate and unsubscribing on OnDeactivate).

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

Sidebar

Related Questions

I have a wpf application using Caliburn.Micro. I need to bind a ListBox to
I have a wpf application using caliburn.micro. It has a datagrid and a combobox.
In my WPF Caliburn.Micro application, I have a datagrid and a checkbox with a
I have WPF Application where I have One main form and other user controls
I have a WPF application that uses Caliburn.Micro. I have a DataGrid: <DataGrid x:Name=WeatherStations
I have a WPF Caliburn.Micro application, and I use MediaPlayer class to play audio.
I have an MVVM-based WPF application that relies on Caliburn.Micro . In one view,
I have a WPF application with Caliburn.Micro. I want to handle slider's move, i.e.
I have a WPF Caliburn.Micro application, and I want to use System.Window.Media.MediaPlayer to play
I have a WPF application with Caliburn.Micro. I have a style defined in ResourceDictionary/Styles.xaml:

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.