Implement support (or extensibility) for printing the whole diagram in a single page.
Most problematic issue when container can contains a container inside of it.
In mvvm demo project i modified load/save button to Clear diagram and display different content.
It works but after few click there is a recurrence call to update Z indices.
The reason to create such combination is to have hierarchy in diagram to display diagram from general view to detailed view.
In a NetCore project, when dragging the diagram from the toolbox into the designer, an exception is thrown inside the designer.
With Visual Studio 2019 Preview v. 16.10.0. Preview 2.0, Net 5 project => when dragging from the ToolBox - the VS goes into a non-responsive state (Vs is busy is shown or the VS crashed and closed automatically).
When you select the Size tab and than select another shape where the Size should not be available, its content is shown whether is enabled or not. The SettingsPane should fallback to an enabled tab when one is disabled. To work this around you can create a custom RadTabControl and implement custom fallback selection logic there. Then replace the RadTabConrol from the ControlTemplate of the SettingsPaneView with the custom tab control. Check the attached project.
Currently large diagrams are hard to export with good quality because of the memory limitation in WritableBitmap when the DPI is increased. -- One option is to use BitMapCacheBrush (discussed here http://www.telerik.com/forums/low-resolution-using-exporttoimage-on-big-diagram) -- Another option is to export multiple images of the diagram which cover it all. Then possibly combine these pictures into one. -- Also , you can try increasing the operating memory of your Visual Studio
Use TextTool to create shape with no text but with background. Pressing enter will close the tool. But the shape remains visible, but you cannot neither select it nor delete it with mouse / keyboard. By design this shape should be removed both from the Shapes collection and from the diagram surface.
As a workaround you can try deleting this shape manually by overriding the Diagram's CommandExecuted event : private void diagram_CommandExecuted(object sender, CommandRoutedEventArgs e) { if (e.Command.Name == "Edit Item") { foreach (RadDiagramTextShape textShape in this.diagram.ChildrenOfType<RadDiagramTextShape>()) { if (!this.diagram.Shapes.Contains(textShape)) { Canvas parent = textShape.Parent as Telerik.Windows.Controls.Diagrams.DiagramSurface; if (parent != null) { parent.Children.Remove(textShape); this.diagram.ServiceLocator.GetService<Telerik.Windows.Diagrams.Core.ISelectionService<IDiagramItem>>().ClearSelection(); } } } }
Currently, the content of RadDiagramShape element alignment can be changed via its HorizontalContentAlignment and VerticalContentAlignment. However, in RadDiagramTextShape, those properties don't take effect. Instead the text content is always centered.
At this point, you can achieve this requirement, by extracting the ControlTemplate of RadDiagramTextShape and bind the corresponding properties of the ContentPresenter to the parent shape. For example:
<ContentPresenter x:Name="NormalContent"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
Hundreds of Connections with ConnectionsBridges turned on in diagram. One on top of the others.
StackOverflowException between updating the Connections' Start/End points.
The exception throws when you use RadDiagram in a data binding scenario by populating its GraphSource and you want to draw a shape using the RadDiagramRibbon's ShapeTool.
InvalidOperationException: 'Cannot modify the Items collection when the GraphSource is set.'
To work this around, use the PreviewMouseDown, PreviewMouseMove and PreviewMouseUp events of RadDiagram in order to prevent the default logic executed by the ShapeTool. Then, in the event handlers, implement a custom logic that works with the diagram GraphSource.
private void RadDiagramRibbon_Loaded(object sender, RoutedEventArgs e)
{
var toolService = diagram.ServiceLocator.GetService<IToolService>() as ToolService;
this.shapeTool = (ShapeTool)toolService.ToolList.FirstOrDefault(x => x is ShapeTool);
}
private Point startPoint;
private bool isShapeCreationInProgress;
private MyNode currentShapeModel; // where MyNode derives from NodeViewModelBase and expose an additional Geometry property
private ShapeTool shapeTool;
private void RadDiagram_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (this.shapeTool.IsActive && !this.isShapeCreationInProgress)
{
this.isShapeCreationInProgress = true;
this.startPoint = this.diagram.GetTransformedPoint(e.GetPosition(this.diagram));
this.currentShapeModel = new MyNode()
{
Geometry = this.shapeTool.Geometry,
Position = this.startPoint,
Width = 0,
Height = 0
};
var source = (MyGraphSource)this.diagram.GraphSource;
source.AddNode(this.currentShapeModel);
e.Handled = true;
}
}
private void RadDiagram_PreviewMouseMove(object sender, MouseEventArgs e)
{
if (this.shapeTool.IsActive && this.currentShapeModel != null && this.isShapeCreationInProgress)
{
var transformedPoint = this.diagram.GetTransformedPoint(e.GetPosition(this.diagram));
var width = Math.Abs(this.startPoint.X - transformedPoint.X);
var height = Math.Abs(this.startPoint.Y - transformedPoint.Y);
var x = Math.Min(this.startPoint.X, transformedPoint.X);
var y = Math.Min(this.startPoint.Y, transformedPoint.Y);
this.currentShapeModel.Width = width;
this.currentShapeModel.Height = height;
this.currentShapeModel.Position = new Point(x, y);
e.Handled = true;
}
}
private void RadDiagram_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
this.isShapeCreationInProgress = false;
e.Handled = true;
}
StackOverflowException is thrown when the Layout() method of RadDiagram is called and the diagram's router is OrgTreeRouter. To reproduce this use TreeLayoutSettings.
To work this around, add bigger HorizontalSeparation and VerticalSeparation for the TreeLayoutSettings. Or disable the connections routing using the RouteConnections property of RadDiagram.
RadDiagram with virtualization turned off. Randomly positioned 5000 shapes are added in Diagram. For the test, Shapes are with simplified template consisting pretty much of a single Border and nothing else. On maximized WPF window, Diagram Load for about 3-3.5 seconds. On normal WPF window, DIagram loads for about 15 seconds.