This is a migrated thread and some comments may be shown as answers.

Styling RadDiagramContainerShape Rad Border when draggin over

1 Answer 58 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Joao
Top achievements
Rank 1
Joao asked on 15 Mar 2021, 10:26 AM

Hi.

I'm creating a UI to drag items from a RadListBox into a RadDiagramContainerShape. When dragging over the container shape a huge red border is generated, but it doesn't mix well with my app look and feel, is is possible to style it or remove it?

 

You can see an example here.

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 18 Mar 2021, 10:06 AM

Hello Joao,

To achieve your requirement, you can extract the ControlTemplate of RadDiagramContainerShape and modify or remove the Border with x:Name set to "DragOverBorder".

An alternative approach is to use the ChildrenOfType<T> extension method to get the Border element in code-behind and customize it there. For example:

private void RadDiagramContainerShape_Loaded(object sender, RoutedEventArgs e)
{
	var container = (RadDiagramContainerShape)sender;
	var dragOverBorder = container.ChildrenOfType<Border>().FirstOrDefault(x => x.Name == "DragOverBorder");
	if (dragOverBorder != null)
	{
		// set BorderBrush, in case you want to only change the color
		dragOverBorder.BorderBrush = Brushes.Green;

		// set Opacity to 0 or BorderThickness to 0, in case you want to hide the border
		dragOverBorder.BorderThickness = new Thickness(0);
	}
}

I hope this helps.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DragAndDrop
Asked by
Joao
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or