Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ERM Diagram Sample (Read 3566 times)
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
ERM Diagram Sample
Jun 5th, 2008 at 4:54pm
Print Post  
I am trying to do something almost exactly like the ERM Diagram displayed in the demo. Couple issues:

1. Is this included as a sample anywhere? I did not see it.

2. I did not go with a custom node and instead just a UIElement, since it was unclear how overriding the Draw() method would work - I don't want to give up any of the XAML drawing of WPF, but it seems like this is necessary if we want a custom node? Is that correct?

3. Our UIElement has the concept of sub-items and expanding (its got a treeview embedded into it), and I'm unsure of how to place anchors *inside* the node like occurs in the ERM diagram.

4. My anchors are very small, but I don't see any options to specify their size anywhere. They inherit from UIElement, not FrameworkElement, so there is no Width / Height properties?

5. Would I be better off just going with a table node? Does that support normal customization via retemplating? (IE, was it designed as a lookless control allowing me to fully customize its display, or will I run into roadblocks there?)

Any help you can provide is appreciated.
  
Back to top
 
IP Logged
 
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Re: ERM Diagram Sample
Reply #1 - Jun 5th, 2008 at 4:55pm
Print Post  
Regarding #3 - that's just setting the X value for the anchor point, correct?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ERM Diagram Sample
Reply #2 - Jun 6th, 2008 at 7:34am
Print Post  
1. There is a sample, but we haven't ported it to WPF yet. Anyway, you could check the Samples\C#\Entities project from our Windows Forms diagramming control:

https://www.mindfusion.eu/FCNetDemo.zip

The methods and properties used to create the nodes there should be the same in the WPF version.

2. UIElements should be fine. When you add an UIElement to the Diagram, it gets a DiagramNodeAdapter created automatically for it. You can access the adapter by means of the DiagramItem attached property, e.g. when you need to set DiagramNode attributes such as AnchorPattern. Accessing the attached node from C# looks like this:

DiagramNodeAdapter node = Diagram.GetDiagramItem(uiElement) as DiagramNodeAdapter;

3. I suppose you could modify the node's AnchorPattern dynamically to move the anchor point to their matching positions inside the TreeView.

4. At this time the built-in anchors have fixed size, You could set AchorPoint's Style to MarkStyle.Custom and handle the DrawMark event to draw larger ones.

5. TableNodes are UIElements and do not support templating, which is available for Control-derived classes.

Note that if you prefer Xaml over custom drawing, you could combine them by keeping Xaml-defined element off-screen, and drawing them using the DrawingContext methods and VisualBrushes that wrap the Xaml elements.

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