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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:35:38+00:00 2026-06-12T23:35:38+00:00

I want to get a reference from a user control view model to the

  • 0

I want to get a reference from a user control view model to the window that holds the user control. How can I do this?

If I can get a reference to the view from view model then I can use:

Window parentWindow = Window.GetWindow(userControlReference); 

So my questions are:

  1. What’s the best way to get the reference from user control view model to the window that holds the user control?
  2. If I want to use the above code, what is the best way to get a reference to view from view model in Caliburn Micro?
  • 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-12T23:35:41+00:00Added an answer on June 12, 2026 at 11:35 pm

    A viewmodel will generally inherit from IViewAware assuming that it’s an IScreen implementation

    You can just cast a Screen to IViewAware and use the GetView() method to get a reference to the view. I think you can implement IViewAware on your own viewmodels and Caliburn will automatically raise the ViewAttached event so you can keep a reference to the view but I might have a look at the docs

    Bottom line: check out the IViewAware interface

    Edit:

    From the docs…

    IViewAware – Implemented by classes which need to be made aware of the view that they are bound to. It has an AttachView method which is called by the framework when it binds the view to the instance. It has a GetView method which the framework calls before creating a view for the instance. This enables caching of complex views or even complex view resolution logic. Finally, it has an event which should be raised when a view is attached to the instance called ViewAttached.

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

Sidebar

Related Questions

I want to get reference on BaseController from AppDelegate. My MainMenu.xib's hierarchy is where
I want to know how we can get record count using reference cursor in
What I want: get a xml from the AppData to use What I code
I want to get data from a DMA enabled, PCIe hardware device into user-space
I want to get a reference to the Gmail Inbox button in Javascript? I
In the Google Chrome debugger, I often want to get a reference to a
I want to hold reference to object so it doesn't get deleted in bind
I want get the time used for a case so I can create an
I want get all of the Geom objects that are related to a certain
I want get as much as possible from Redis + Hiredis + libevent. I'm

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.