I would like to use custom shapes together with MVVM. I have followed the online documentation regarding MVVM and RadDiagram:
http://www.telerik.com/help/wpf/raddiagrams-howto-mvvm.html
But I do not know how to create custom shapes when using MVVM - could you please provide an example?
Thanks,
Michael
4 Answers, 1 is accepted
It is possible to use Custom Shapes in MVVM scenario. Actually this is demonstrated in our MindMap and OrgChart samples. The key moments in this requirement are:
1) Inherit the RadDiagramShapeBase and create custom Shape like in this help article.
2) Inherit the RadDiagram and override the following methods:
protected
override
Telerik.Windows.Diagrams.Core.IShape GetShapeContainerForItemOverride(
object
item)
{
return
ShapeSelector.GetShape(item);
}
protected
override
bool
IsItemItsOwnShapeContainerOverride(
object
item)
{
return
item
is
MindmapShapeBase;
}
3) Use Style Selector to return a Style depending on the type of the business object.
You can find these steps implemented in the attached project as well. Kind regards,
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Michael
I need to create a wpf diagram designer which consist multiple layers design (user can add layers according to need and can switch among layers and can also show/ hide layers) and each layer can have different diagram but they are party of single design. Now my question is that how we can create multiple layers like we have different layers in photoshop where layers are used to work on individual parts of an image while not affecting other parts. And the same thing I have to create in wpf diagram designer .....
As Lancelot explained in this forum post, the RadDiagram don't provide layers out-of-the-box but you can easily create custom layers by applying different ZIndex settings on the different shapes. Once you create your layers of shapes, you can mark each shape in order to know the layer it belongs to (you can use DataBinding and business values to differentiate the layers and the shapes or simply use the Tag property of the shapes). Once you can tell the layer in which a shape belongs, you can traverse the RadDiagram shapes collection and find all shapes of a certain layer to hide or display them together.
Please let us know if this information helps.
Regards,
Tina Stancheva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.