DropOntoBehavior

I have a datatemplate for a node that produces the thing in a group as shown in the figure (pointed by red arrow)





DataTemplate is like this



<Border BorderBrush=“Black” BorderThickness=“1” HorizontalAlignment=“Center” VerticalAlignment=“Top”

go:Part.Movable=“False”>



<TextBlock Text=" " MinWidth=“5”

Background="{Binding Path=Part.IsDropOntoAccepted, Converter={StaticResource theBooleanBrushConverter}}"

go:Part.DropOntoBehavior=“AddsLinkToNode”

go:Node.ToSpot=“LeftSide”/>



<TextBlock Text=" " MinWidth=“5”

Background="{Binding Path=Part.IsDropOntoAccepted, Converter={StaticResource theBooleanBrushConverter}}"

go:Part.DropOntoBehavior=“AddsLinkFromNode”

go:Node.FromSpot=“RightSide”/>









What I am trying to achieve here is that colour on either side of the text block (black bits) changes when an item from the Pallete is dragged on top of it and when this item is dropped it should only connect on Right of the right side black bit and on left side of the left bit.



Is this achieveable in any way

Walter is on the road, I think you’ll find some help in this forum entry.

Setting go:Part.DropOntoBehavior on a nested element has no effect – that property should only be set on the root visual element of the template.

But it’s interesting what you are doing, so I guess we could consider some extensions. For your purposes, at this time, I think you’ll need to customize the code. I can look into this. What platform are you using?

By the way, instead of using a TextBlock, you could just use a Rectangle. I think that would make the intent more clear, particularly if you also set the Width and Height, as one would normally do in this situation.

Hi Walter Thanks for your time. We are using Visual Studio 2008 and .NET 3.5 SP1 (WPF)


It will be great if you could consider some sort of enhancement to accomodate this type of behaviour and thanks for the suggestion I agree that using a rectangle makes more sense in this case instead of TextBlock

BTW - that image I posted might look familiar as I am using the modified table layout that you did (with a few changes).