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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:17:56+00:00 2026-06-04T02:17:56+00:00

I am making a little game in WPF to understand it better, I have

  • 0

I am making a little game in WPF to understand it better, I have a parent control that has 2 child usercontrols.

The first child user control has buttons that update the position of an object in the second usercontrol.

In the MainWindow.xaml.cs
I have

controllersplaceholder.Content = new ControllerView1()
gameplaceholder.Content = new GameView1() 

As you can see, controllersplaceholder has no knowledge whatsoever of GameView1.
To update a position of an element in GameView1 I would have to pass GameView1 reference into ControllerView1 and execute methods in GameView1().
Question is how can I do it so that
ControllerView1,ControllerView2 will execute methods in GameView1 easily.

  • 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-04T02:17:58+00:00Added an answer on June 4, 2026 at 2:17 am

    You can use events. Simply declare an event on your ControllerView1, say:

    public event EventHandler RequestReposition;
    

    When creating your objects, make GameView1 subscribe and react to controller’s event:

    var controller = new ControllerView1();
    var gameView = new GameView1();
    // here we're subscribing to controller's event
    controller.RequestReposition += gameView.UpdatePosition;
    controllersplaceholder.Content = controller;
    gameplaceholder.Content = gameView;
    

    Now, whenever you raise an event from controller, whoever subscribed will be notified and proper actions will be taken (execution of subscribed methods).

    Note that your game view method doesn’t have to match event signature exactly; with a little help from anonymous methods you can create matching event handler on the fly and use already existing methods from GameView1:

    // subscribtion with lambda
    controller.RequestReposition += (sender, args) =>
        {
            gameView.UpdatePosition();
            gameView.Refresh();
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a basic little game in Java and I want to have
I`m making an little php server that has 2 clients, on connects to the
I'm making a little game framework that appends Canvas elements to a DIV but
I'm making a little game for iPhone that involves whistling. The phone hears the
I am making a little webgame that has tasks and solutions, the solutions are
So, I'm making this little game where you have a flashlight. The flashlight is
I'm making a game in OpenGL. I have a viewport that is multiplied by
I'm making a simple WP7 game and I have a little problem with orientation
I have a silly little game that I made just for myself, but I
So I am making a little game where you have to press Ctrl to

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.