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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:25:22+00:00 2026-05-18T02:25:22+00:00

I have a UserControl, we’ll call it myUC , that is one among several

  • 0

I have a UserControl, we’ll call it myUC, that is one among several UserControls in the main window (myWindow) of my WPF application. myUC contains a number of standard controls, one of them being a button, we’ll call it myButton.

When I click myButton, I would like to execute myMethod(), which exists in the code-behind of myWindow.

The problem being that myUC doesn’t have any idea that myWindow even exists, much less that myMethod exists.

How can I send the message: ‘Hey, myWindow, wake up. myButton on myUc was just clicked; please run myMethod’?

  • 1 1 Answer
  • 1 View
  • 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-18T02:25:23+00:00Added an answer on May 18, 2026 at 2:25 am

    You can create a command in the window and set the Command property of the button to the name of this command. Clicking the button will fire the command, without a need for a reference to the parent window.

    This tutorial explains everything very clearly.

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

Sidebar

Related Questions

I have a UserControl which contains a TextBox . When my main window loads
I have a usercontrol (UC) that is sometimes in a window and sometimes in
I have one UserControl nested inside the other UserControl, something like that: <uc:MyControl1> <uc:MyControl2
I have a WPF UserControl that I'd like to inject dependencies into. What's the
I have a usercontrol that I'm adding as a control of a main form
I have a UserControl in WPF that contain a textBox. My user control is
I have a usercontrol, that when one property changes, the bindings change for a
I have a UserControl class in a Windows Application project. One of the properties
I have a UserControl that consists of a Parent and Child UserControls that is
I have a usercontrol in WPF that have 2 buttons inside. The buttons are

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.