Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram Bounds Update within UserControl (Read 3516 times)
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
Diagram Bounds Update within UserControl
Feb 28th, 2008 at 12:33pm
Print Post  
Hi again.

I've manage d to reproduce what appears to be an unhandled exception within the Diagramming DLL.
The following describes a situation where no exception is encountered:

1) Place a diagram on the main form, set to automatic height / width and WPFPoint measurement unit (this unit is not required as such, it just keeps the diagram small to make things easier)
2) Add a button to the form
3) In the button click event add

Diagram1.Bounds = New Rect(1, 1, Me.Height, Me.Width)

4) Run app
5) Maximise window
6) Click button

The diagram resizes as expected (well, almost as expected, as in my app the me.height and me.width didn't seem to increase after the maximize).

The following steps replicate exception:

7) Now add a new UserControl to the project and replicate the objects and code from the main form (diagram, button and click event).
8) create an instance of the new user control on the main form
9) set width and height of user control to auto, ensuring no margins
10) run app again and click the button within the usercontrol.

At this point I generally found that nothing would appear to happen but if I alt+tabbed back to VS there was an exception window waiting for me saying:

System.InvalidOperationException was unhandled
Message="Layout measurement override of element 'MindFusion.Diagramming.Wpf.Diagram' should not return NaN values as its DesiredSize."

I can post full exception stack trace if required.


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram Bounds Update within UserControl
Reply #1 - Feb 29th, 2008 at 11:54am
Print Post  
Hi,

Thank you for reporting this problem. We will fix it next week.

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



Posts: 128
Joined: Aug 15th, 2007
Re: Diagram Bounds Update within UserControl
Reply #2 - Feb 29th, 2008 at 12:00pm
Print Post  
Outstanding - I knew I could rely you folks Smiley

Have a good weekend.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram Bounds Update within UserControl
Reply #3 - Mar 4th, 2008 at 3:20pm
Print Post  
What are the Me.Width and Me.Height values before you assign them to Diagram.Bounds? Our guess is that the exception happens if they are set to NaN. Perhaps this is the value WPF returns if the properties are not explicitly set, or if they are set to"Auto" in XAML. Instead of Width and Height, try to assign Me.ActualWidth and Me.ActualHeight to Diagram.Bounds.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
Re: Diagram Bounds Update within UserControl
Reply #4 - Mar 5th, 2008 at 9:04am
Print Post  
Hi Stoyan

Using the 'Actual' values worked - thanks for the assistance.


best regards

Paul
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint