Page Index Toggle Pages: 1 2 [3] 4  Send TopicPrint
Very Hot Topic (More than 25 Replies) WPF (Read 46503 times)
Paul Eden
Full Member
***
Offline



Posts: 128
Joined: Aug 15th, 2007
Re: WPF
Reply #30 - Nov 20th, 2007 at 2:04pm
Print Post  
Hi

I have just noticed that the version number on the Diagramming.WPF dll you just provided is 4.3.1.29488, where as the one you gave out in October was versioned as 4.3.1.30344

Could you confirm that this is correct as there are some issues occuring during use:

When ever scrollbars are enabled on the control it appears to have a catastrophic effect on the solution (no further builds possible) and the size of the diagram canvas area seems to have a hard coded default, where by the width is 20x20, although it's shape on the form is rectangular. 

It seems that the control defaults to a particular size (regardless of size drawn on form) and then dynamicly resizes during run time use if it detects that it is neccessary.


Many thanks
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #31 - Nov 20th, 2007 at 2:37pm
Print Post  
Hi,

The build number could be a smaller one if our developers have built this dll on a different PC than the one used for the dll from October. You will have build problems if you do not replace the common.dll too with the one from the zip.

I don't quite understand what problem you are having with scrolling. There are two size properties related to the control - the Width and Height are in pixels and specify the view size. Bounds specifies the logical document size, which can be larger than the view size. In that case you can use ScrollViewer to let users scroll the diagram. You might also check if the AutoResize property has some relation to the  behavior you describe.

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



Posts: 128
Joined: Aug 15th, 2007
Re: WPF
Reply #32 - Nov 20th, 2007 at 3:56pm
Print Post  
Regarding build numbers, fair enough Smiley just needed to be sure.

For info, my environment is Windows Vista using VS 2008 (Beta) and Expression Blend.

The following are steps I take that will reproduce issues.

1.
Using VS2008, create a new project, add references to Mindfusion DLLs, add Diagram object to toolbox.  Double click diagram icon to create Diagram control on window; generates "The property 'FrameworkElement.Width' is read-only and cannot be changed."  Same message generated if control drawn manually.

2a.
Using Expression Blend, create a new project, add references to Mindfusion DLLs, add Diagram control to toolbar and double click to create on window.  By default the following values are set:
Width=20
Height=20
Diagram.Width=20
Diagram.Height=20
Bounds=0,0,210,100
HorizontalAlignment=Left
VerticalAlignment=Top

My form is:
Width=640
Height=480

With the diagram control selected, it fills the width of the form, over hanging by about a quarter of the form width.  It fills about 85% of the height of the form.
Any attempt to modify the height or width of the control (not the bounds) by manually changing the values results in the message "The element <element name> could not be displayed because of a problem with System.Double.  Object reference not set to an instance of an object."  Reverting to 20 fixes this.


2b.
Continuing from above, resize diagram control to match form width (640) using the controls handles.  Width properties on diagram control remain at 20.

2c.
Changing control horizontal alignments to either Right or Stretch causes the handles of the control to be moved out of alignment with the visible control area - it seems to align the handles to its bounds.  The same occurrs with vertical alignments Bottom or Stretch.

Enableing scrollbars on the ocntrol seems to cause VS an issue, but this may be just a VS thing.

Hope any of this is useful to you guys.


Regards


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #33 - Nov 21st, 2007 at 12:37pm
Print Post  
Ok, we have never tried adding the control from the VS toolbox, but created all samples by editing the XAML directly. Now we have tried it and got the same exception. We cannot find yet why it is thrown in the VS designer, while setting the Width works fine both from XAML and from code. For now, you too can use XAML or code to set Width and Height.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #34 - Nov 21st, 2007 at 1:37pm
Print Post  
This version should work better:
https://mindfusion.org/_beta/wpf_zoom2.zip

The problem was that the control had an attached property called Width, used to set the widths of diagram items. Instead of setting the Width property derived from Control, VS was trying to assign to the attached property trough the Reflection API, but without actually specifying an item for which the value should be set.

Now we have renamed the attached properties to ItemWidth and ItemHeight, and it seems this fixes the problem.

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



Posts: 128
Joined: Aug 15th, 2007
Re: WPF
Reply #35 - Nov 22nd, 2007 at 2:49pm
Print Post  
[quote author=Stoyo link=1189764935/15#28 date=1195560586] Letting the user draw controls interactively should look like

d.Behavior = Behavior.Custom;
d.CustomNodeType = typeof(MyTextBox);

Stoyan[/quote]

Hi again

Was wondering if you could confirm method for creating a control as a node  programatically?

I assumed it would be by creating a new DiagramNode via the factory off of the diagram object and then setting it's type (though I couldn't find a property that appearded to suit the task).

While I can use the Factory.CreateDiagramNode to create a new node, I get a 'Method or operation not implimented' exception after the code completes.  For example, in the constructor for my form i have placed the following:

Dim oNode As Mindfusion.Diagramming.WFP.DiagramNode= oFlow.Factory.CreateDiagramNode(10, 10 ,50, 50)
oNode.Visible=True

If I single step through the code, the above lines execute but when I exit the contructor the exception is generated (this same behaviour is exhibited if I place the code in a mouse click event).

Instead I tred oFlow.Items.Add (new <UIElement>).  While this did work, I have no control over size or positioning.
I'm used to the version 4 concept of the ControlHost - currently I can't see how to acheive a similar result.


Many thanks
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #36 - Nov 23rd, 2007 at 8:58am
Print Post  
Hi,

Here are several methods of doing that:

// how to set bounds of custom nodes
Rect bounds = new Rect(60, 40, 20, 20);
Button b = new Button();
d.Items.Add(b);

// variant 1 - using attached properties
Diagram.SetItemTop(b, bounds.Top);
Diagram.SetItemLeft(b, bounds.Left);
Diagram.SetItemWidth(b, bounds.Width);
Diagram.SetItemHeight(b, bounds.Height);

// variant 2 - shortcut version of variant 1
Diagram.SetItemBounds(b, bounds);

// variant 3 - using FrameworkElement.Width, FrameworkElement.Height
// Top and Left cannot be set this way
b.Width = bounds.Width;
b.Height = bounds.Height;

// variant 4 - using DiagramNode adapter class
DiagramNode buttonNode = (DiagramNode)Diagram.GetDiagramItem(b);
buttonNode.Bounds = bounds;

This version just renames the Top and Left attached properties to ItemTop and ItemLeft, for consistency with the ItemWidth and ItemHeight property names:
https://mindfusion.org/_temp/wpf_att.zip

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



Posts: 128
Joined: Aug 15th, 2007
Re: WPF
Reply #37 - Nov 28th, 2007 at 3:32pm
Print Post  
Hi Stoyan

Many thanks for that code snippet - works just as I was trying to do.

I have however found another possible issue:

Setting the background via expression blend UI in the Brushes section to 'No Brush' prevents drawing on the control at run time.
Setting the background via the Appearance section in Blend to 'No Brush' causes the exception "null is not an acceptable Brush value" at desing time.


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #38 - Nov 29th, 2007 at 6:55am
Print Post  
Hi Paul,

This is by design, the Brush property setter throws an exception when the assigned value is null. This is probably needed only for the Windows Forms version. The compositing system in WPF is much better and perhaps we can safely use what's behind the diagram as a background when the brush is null. However we are now close to releasing the first version of the WPF control, so we won't change this behavior, but can implement support for null-brushes in the 1.0.1 release.

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



Posts: 128
Joined: Aug 15th, 2007
Re: WPF
Reply #39 - Nov 29th, 2007 at 8:32am
Print Post  
Once again many thanks for your prompt reponse.  I imagine that many people eagerly await version 1 Smiley
Will you be setting up a separate forum for WPF discussion / bugs etc?


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #40 - Nov 29th, 2007 at 1:46pm
Print Post  
Yes, we'll have a separate forum for the WPF version, and will move this thread there for a start  8)

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



Posts: 128
Joined: Aug 15th, 2007
Re: WPF
Reply #41 - Dec 4th, 2007 at 2:12pm
Print Post  
Possibly for the 1.1 release, but do you have any plans to bring the behavour of the bounds and visible area more in line with each other?
Creating a uniform UI is challenging when attempting to cater for changing window sizes.  It would be much nicer to have to control display as much diagram space as possible based on its size.
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #42 - Dec 4th, 2007 at 4:17pm
Print Post  
What exactly is wrong with Diagram.Bounds?

If you need to auto-scale the diagram so that it always fits the visible area, I believe the WPF Viewbox control can help you with that. Viewbox auto-scales its content to fit the available space. We haven't tested how the Diagram control works inside a Viewbox though. If there is some functionality that Viewbox expects from its contained controls and is missing from the Diagram, then this will have to wait for the 1.0.1 release 8)

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



Posts: 128
Joined: Aug 15th, 2007
Re: WPF
Reply #43 - Dec 6th, 2007 at 2:11pm
Print Post  
Hi Stoyan

Thanks for the suggestion about the viewbox, but as you say, this only scales the current size / bounds of the diagram canvas and does not really achieve what we want as it makes things monsterously big Smiley  When I tried it though, I did not get any errors.

It would be a valuable feature if the bounds remained synchronised with the visible size of the control, but of course never going below the area used by nodes on the diagram.  While the diagram bounds could be set very large to ensure all screen sizes are catered for, a gradianted background spands the bounds rather then the visible size so it's effect is lost.
On another bounds relateditem, when a node is drawn on the diagram near the edge of the bouds, the bounds will automaticly increase in size to cater for the additional space required.  When controls are created programaticly, this re-sizing does not seem to occurr.  The nodes are drawn in the correct physical location but the bounds remain the same.  Could you confirm if correct / a bug?  Of course, it's not impossible I'm doing something wrong... Smiley


Many thanks
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: WPF
Reply #44 - Dec 6th, 2007 at 4:34pm
Print Post  
I think I get it now  8)

Regarding increasing the bounds size, you must call ResizeToFitItems after creating nodes programmatically. That's not done automatically after adding a node from code, because resizing the bounds invalidates the WPF container layout. That could slow down your application a lot, e.g. if you add a few hundred items in a loop.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 4 
Send TopicPrint