This is a regressiion issue in the 2024.3.924 release of Telerik UI for WPF.
Save and load of the saved XML should result of the same item IDs for every RadDiagramItem (shapes, connections).
To work this around, you can create a custom SerializationService and override its DeserializeItems method, where you can change the "makeUnique" parameter.
The issue manifests also when doing drag/drop from the RadDiagramToolBox or any other custom drag drop implementation that uses the DiagramDropInfo class (which is automatically handled by the RadDiagram's drop internal code). In this case the custom service approach won't work because the drag/drop deserialization works with a separate instance of SerializationService (SerializationService.Default) which cannot be changed. In this case, you can subscribe RadDiagram to the DragDropManaged.Drop event and manually call the SerializationService.Default.DeserializeItems method.
public class CustomSerializationService : SerializationService
{
public CustomSerializationService(IGraphInternal graph) : base(graph)
{
}
public override IEnumerable<IDiagramItem> DeserializeItems(SerializationInfo serializationInfo, bool makeUnique = false)
{
makeUnique = false;
return base.DeserializeItems(serializationInfo, makeUnique);
}
}
public MainWindow()
{
InitializeComponent();
this.diagram.ServiceLocator.Register<ISerializationService>(new CustomSerializationService(this.diagram));
DragDropManager.AddDropHandler(this.diagram, OnDiagramDrop);
}
private void OnDiagramDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
var data = DragDropPayloadManager.GetDataFromObject(e.Data, typeof(DiagramDropInfo).Name);
if (data is DiagramDropInfo)
{
SerializationService.Default.DeserializeItems(((DiagramDropInfo)data).Info, false);
}
}
In the Swimlane diagram example (Data Visualization -> Diagrams -> Swimlane) the application crashes, showing at least one but often more than one error message.
How to reproduce:
{DependencyProperty.UnsetValue} is not a valid value for the Property "Background"pop up (see other screenshot)
Hi,
In project we have noticed that sometimes for RadDiagram.ConnectionManipulationCompleted we receive unexpected values in event.
This problem is not systematic but it occurs often at the drag of new connection.
To make it reproducible for you I used CustomConnectors sample project from Diagram.
For easier analysis I recorded a video with bug and changes to CustomConnectors project.
Best regards,
Bartosz
NullReferenceException is thrown when trying to save RadDiagram instance that contains a RadDiagramShape with its Geometry assigned to a GeometryGroup value.
To work this around, you can flatten the GeometryGroup before setting the shape's Geometry property. This is done by calling the GetFlattenedPathGeometry() method of the GeometryGroup.
shape.Geometry = group.GetFlattenedPathGeometry();
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.
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(); } } } }