Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can I add more templates and primitives to the Shape designer? (Read 1586 times)
Centron
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Feb 11th, 2015
Can I add more templates and primitives to the Shape designer?
Feb 11th, 2015 at 2:12pm
Print Post  
As the question says. What are my options to extend the functionality of the designer in terms of pre-defined shapes? Can I somehow import all pre-installed shapes into the designer to use them as templates, or am I limited to the square, diamond, and oval?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Can I add more templates and primitives to the Shape designer?
Reply #1 - Feb 12th, 2015 at 8:39am
Print Post  
There's no support for custom elements in the designer at this time. If you need to provide users with templates as a starting point only, you could add some ShapeNodes to a NodeListView and import their shape upon drag-and-drop:

Code
Select All
<diag:ShapeDesigner
	x:Name="designer"
	Height="200" Width="300"
	AllowDrop="True"
	DragOver="OnDesignerDrag"
	Drop="OnDesignerDrop" />

private void OnDesignerDrag(object sender, DragEventArgs e)
{
	e.Effects = DragDropEffects.Copy;
	e.Handled = true;
}

private void OnDesignerDrop(object sender, DragEventArgs e)
{
	var draggedNode = (DraggedNode)e.Data.GetData(typeof(DraggedNode));
	var shapeNode = (ShapeNode)draggedNode.Node;
	designer.ImportShape(shapeNode.Shape);
	e.Effects = DragDropEffects.Copy;
	e.Handled = true;
} 



We are improving the designer for upcoming release (e.g. to show grid and allow defining anchor points), and could also implement a method for adding new templates if it will help you. The templates in the designer's palette are lists of ElementTemplate -derived objects, so you will be able to add only predefined Shape.Outline lists there instead of full shape's definitions (including decoration lines and filled decorations).

The Primitives palette shows single ElementTemplate -derived objects, and if you need to add to it you'd have to implement both a new ElementTemplate class and a companion builder class used by the designer to represent the element.

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