New to Telerik UI for WPFStart a free 30-day trial

Change the Colors of the Shape Dropped from RadDiagram Toolbox

Updated on Sep 15, 2025

Environment

ProductVersion
RadDiagram for WPF2023.2.606

Description

How to change the background and border brush a shape dragged from the RadDiagramToolBox, when the shape get dropped onto the RadDiagram surface.

Solution

You can subscribe to the SerializationService.Default.ItemSerializing event. In the event handler, you can update the "Background" and "BorderBrush" settings of the SerializationInfo object.

C#
	public MainWindow()
	{
		InitializeComponent();
		SerializationService.Default.ItemSerializing += Default_ItemSerializing;
	}

	private void Default_ItemSerializing(object sender, SerializationEventArgs<IDiagramItem> e)
	{
		var shape = e.Entity as RadDiagramShape;
		if (shape != null && shape.ParentOfType<RadDiagramToolbox>() != null)
		{
			e.SerializationInfo["Background"] = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#8EC251"));
			e.SerializationInfo["BorderBrush"] = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#8EC251"));
		}
	}

In case you need to change also the colors of the shape when displayed inside the RadDiagramToolBox, then you can add an implicit style in the RadDiagramToolBox.Resources tag and target the RadDiagramShape controls.

XAML
       <telerik:RadDiagramToolbox.Resources>
		<Style TargetType="telerik:RadDiagramShape">
			<Setter Property="Background" Value="#8EC251" />
			<Setter Property="BorderBrush" Value="#8EC251" />
		</Style>
	</telerik:RadDiagramToolbox.Resources>
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support