Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Viewport3D Usage Within Nodes (Read 3942 times)
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
Viewport3D Usage Within Nodes
Jan 19th, 2009 at 5:41pm
Print Post  
Hi

We have some code that we are porting to a UserControl that makes use of the Viewport3D object.  With the code in it's original state, the view port and it's content works as expected.  When the new UserControl (which is a direct copy of the code, just separated from other parts of the app) is put onto a DiagramCanvas as a node, mouse clicks do not reach the Viewport3D (clicks to other object work as expected, such as buttons / scrollbars etc).  Due to the nture of the project I can't post reproduction code, but is there anything you folks can think of that may effect it?

Many thanks


Paul
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Viewport3D Usage Within Nodes
Reply #1 - Jan 20th, 2009 at 10:03am
Print Post  
Hi,

Seems Viewport3D's MouseDown event is raised only when you click on some 3D object rendered there, regardless of whether Viewport3D is placed as a node in the diagram or inside another WPF container.

Stoyan
  
Back to top
 
IP Logged
 
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
Re: Viewport3D Usage Within Nodes
Reply #2 - Jan 20th, 2009 at 10:55am
Print Post  
Hi Stoyan

Yes, I'd agree with that, but even clicking on one of the 3d object yeilds no click event when inside the node - is this what you would expect?
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Viewport3D Usage Within Nodes
Reply #3 - Jan 20th, 2009 at 11:08am
Print Post  
Viewport3D.MouseDown is raised as expected in our test application, where the Viewport3D is inside a diagram node. Is it what you mean by 'click' event? You might check if some PreviewMouseDown handler in your user control sets Handled = true; that would stop the event propagation.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Viewport3D Usage Within Nodes
Reply #4 - Jan 20th, 2009 at 11:42am
Print Post  
This is our test project:
https://mindfusion.eu/_samples/Viewport3DTest.zip

It just calls Debug.Write from the MouseDown handler.
  
Back to top
 
IP Logged
 
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
Re: Viewport3D Usage Within Nodes
Reply #5 - Jan 21st, 2009 at 11:43am
Print Post  
Well technically the project you have there is responding to the MouseDown on the UserControl, rather than the ViewPort contained within it - mouse clicks go to our UserControl no problem as it is a composite control with buttons etc the only object that does not respond / receive the click / mousedown is the viewport content.

I have no Preview events defined.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Viewport3D Usage Within Nodes
Reply #6 - Jan 22nd, 2009 at 3:37pm
Print Post  
Technically this just shows that the event bubbles correctly. You can handle it directly from the viewport if you wish: set the Viewport's Name attribute in the xaml, expose it as a property of the user control:

public Viewport3D Viewport
{
     get { return viewport; }
}

and change the uc.MouseDown += ... line to

uc.Viewport.MouseDown += (s, e) => { Debug.WriteLine(e.Source.GetType().ToString()); };

This displays "System.Windows.Controls.Viewport3D" in our test app.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint