Hundreds of Connections with ConnectionsBridges turned on in diagram. One on top of the others.
StackOverflowException between updating the Connections' Start/End points.
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}"/>
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).
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.
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;
}
I looked at the RadDiagram options, but it doesn't have anything that compares to a circular relationship chart. Here's an example:
https://www.codeproject.com/KB/silverlight/342715/screenshot2.png
Part of this article:
https://www.codeproject.com/Articles/342715/Plotting-Circular-Relationship-Graphs-with-Silverl
I gave some thought at trying to rewrite the code into WPF, but I've got too many other irons in the fire. Figured I'd ask as this sort of visualization control doesn't appear in your current collection. I have a project that could benefit from displaying weighted relationships in such a manner, but my choices are either do something sub-par with the RadDiagram option, write one myself, find another controls collection and port everything, or leave the feature out for now. I'm going for the leave it out option for the moment, and see if your UI wizards can come up with something...
Just as a use case, one of the reasons for wanting this is to diagram conversations between individuals in email messages. Being able to show who's talking to whom and how frequently using one of these charts for visualization allows you to quickly find patterns...
While performing Cut operation inside RadDiagram, an exception in the MS Clipboard occurs with the following message:
System.Runtime.InteropServices.COMException: 'OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))'