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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:42:27+00:00 2026-06-15T16:42:27+00:00

I have two different windows, one will to display streams on a image and

  • 0

I have two different windows, one will to display streams on a image and calculate a user’s skeleton head position (window A), and another is display a 3D visual model that will use the skeleton data to zoom and translate(animation)(window B).

However, my problem is how can I suppose to pass and keep updating these skeleton head position data from window A to window B? I am using WPF and M’soft Kinect SDK. My another question is that how can I display a control like a button or a menu on the visual model as for my case the model is filled up the whole screen.

  foreach (Skeleton skeleton in skeletons)
    {
        if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
        {

            ht.GetHeadPosition(skeleton, out message, out headPosition);

            this.headPoint.X = headPosition.X;
            this.headPoint.Y = headPosition.Y;
            this.headPoint.Z = headPosition.Z;

            this.StatusTextBlock.Text = message;

        }

Edit


  public void newSensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
    {
        using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
        {
            if (skeletonFrame == null)
                 return;

             GetSkeletons(skeletonFrame, ref skeletons);

             if (skeletons.All(s => s.TrackingState == SkeletonTrackingState.NotTracked))
                 return;

             //skeletonManager.Draw(skeletons);
        }

        foreach (Skeleton skeleton in skeletons)
        {
            if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
            {
                Joint headJoint = skeleton.Joints[JointType.Head];
                Joint hipCenter = skeleton.Joints[JointType.HipCenter];

                headPosition = headJoint.Position;

                this.headPoint.X = headPosition.X;
                this.headPoint.Y = headPosition.Y;
                this.headPoint.Z = headPosition.Z;

                message = string.Format("Head: X:{0:0.0} Y:{1:0.0} Z:{2:0.0}",
                headPoint.X,
                headPoint.Y, headPoint.Z);

                //MessageBox.Show(message);

                this.HeadPosition.Text = message;
            }
        }
    }

I can’t get the HeadPosition.Text update with the data.What actually happened?

kinect changed event handler at window A

    private void sensorChooser_KinectChanged(object sender, KinectChangedEventArgs e)
    {
        KinectSensor oldSensor = (KinectSensor)e.OldSensor;
        StopKinect(oldSensor);

        KinectSensor newSensor = (KinectSensor)e.NewSensor;

        if (newSensor == null)
        {
            return;
        }

        //Register for event and enable Kinect Sensor features you want
        newSensor.DepthFrameReady += newSensor_DepthFrameReady;
        newSensor.SkeletonFrameReady += mw.newSensor_SkeletonFrameReady;

        //newSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
        newSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);

       ....

        newSensor.SkeletonStream.Enable(parameter);

        StartKinect(newSensor);

    }

XAML____________________________________________________________

  <Grid x:Name="firstGrid">
    <Viewport3D x:Name="viewPort" Grid.Column="0" Grid.Row="0" ClipToBounds="False" Width="2048" 
    ....
    .....
    </Viewport3D>

    <TextBox x:Name="IndexPosition" HorizontalAlignment="Left" Height="23" Margin="485,2,0,0"   TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="69"/>

    <TextBox x:Name="CameraPosition" HorizontalAlignment="Left" Height="23" Margin="570,2,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="142"/>

    <TextBlock Name="HeadPosition" HorizontalAlignment="Left" Margin="492,23,0,0" Text="Text" VerticalAlignment="Top" Width="182" Height="29" 
               Foreground="Tomato" FontSize="20"/>
  • 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-15T16:42:28+00:00Added an answer on June 15, 2026 at 4:42 pm

    You can do this in one of many different ways. It all depends on how you want to seperate the code in your program.

    Option 1: Public Event Handlers

    You could set up public event handlers in Window B that subscribe to the SkeletonFrameReady event from the KinectSensor. For example, in the class that sets up your KinectSensor you might have something like:

    WindowB windowB = new WindowB();
    
    private void InitializeKinectServices(KinectSensor sensor)
    {
        // some setup code
    
        sensor.SkeletonFrameReady += windowB.OnSkeletonFrameReady;
    
        // some more setup code
    }
    

    Then in your WindowB class you would have the event callback:

    public void OnSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
    {
        using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
        {
            // do what you need
        }
    }
    

    Option 2: Pass the Sensor

    You could set up your window(s) to accept a reference to the KinectSensor. When you open the second window from your main class, just pass the sensor in:

    WindowB windowB = new WindowB(sensor);
    

    With your constructor of WindowB taking a KinectSensor and then setting up the callback from above:

    public WindowB(KinectSensor sensor) {
        sensor.SkeletonFrameReady += OnSkeletonFrameReady;
    }
    
    private void OnSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
    {
        using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
        {
            // do what you need
        }
    }
    

    Notice this allows your callback to be private.

    Option 3: Using a Framework Messenger

    You could also use a framework messenger, such as MVVM Light. MVVM Light provides a lightweight messenger system that allows you to easily pass objects around from one view to the the next. While this is more useful in a MVVM structured program that doesn’t mean you can’t use it outside one.

    You can broadcast the entire SkeletonFrameReadyEventArgs out from your main classes SkeletonFrameReady callback:

    private void OnSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
    {
        Messenger.Default.Send<SkeletonFrameReadyEventArgs>(e);
    
        // do more stuff
    }
    

    Then you just need to subscribe to it from you WindowB:

    public WindowB() {
        Messenger.Default.Register<SkeletonFrameReadyEventArgs>(this, OnSkeletonFrameReady);
    }
    
    private void OnSkeletonFrameReady(SkeletonFrameReadyEventArgs e)
    {
        // do what you need with the event arg, just as you would in a regular callback
    }
    

    Or you could just send the individual Skeleton, fromo your main class:

    private void OnSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
    {
        using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
        {
            // do checks for capturing the appropriate skeleton.
    
            Messenger.Default.Send<SkeletonFrame>(skeletonFrame);
    
            // do more stuff if you need.
        }
    }
    

    Your WindowB would then register, as shown above, on a SkeletonFrame instead of the event args. The callback would do what it needs to do with the SkeletonFrame object.

    What’s Best?

    Up to you. There are several other ways you could ultimately do this. These are the first three I thought of. They will all accomplish the same thing — you just want to use the one your are most comfortable with for your program style.

    Maximizing the Window

    To maximize the window, you can place a button in your XAML and setup a callback to toggle between the Maximized and Normal window state.

    XAML:

    <Button Click="MyButton_Click">Click Me</Button>
    

    Code Behind:

    bool _isMaxed = false;
    public void MyButton_Click(object sender, RoutedEventArgs e)
    {
      if (_isMaxed)
          this.WindowState = WindowState.Normal;
      else
          this.WindowState = WindowState.Maximized;
    
      _isMaxed = !_isMaxed;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to have two different foci/focuses on X windows?
I have Process objects that are monitored from two different views. A Windows.Forms.ListView (actually
Scenario I have a windows forms application. I want to use two different WCF
I have two different styles for my window: Regular - window has title bar
I have two different libGL libraries on the same Ubuntu 11.04 machine. One library
I have two different arrays, one with strings and another with ints. I want
I have some Delphi 2007 code which runs in two different applications, one is
I need to create one installer which will install components on two different machines.
I have two different servers, and I need to send post data from one
I have two different buttons on my page. I want them both to be

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.