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)
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);
}
}