Using a converter to bind to a Node's ZOrder property

I am trying to have Node.ZOrder have a higher value while it is being dragged. I pass the converter the Node’s ElevationModelData, which derives from GraphLinksModelNodeData. ElevationModelData.ZIndex contains the original value, and ElevationModelData.Dragging is set to true when the node is being dragged and false otherwise. Am I allowed to do this? What am I doing wrong? Thanks.

<local:DraggingZOrderConverter x:Key="DraggingZOrder" />
...
<DataTemplate>
    ...
    go:Node.ZOrder="{Binding Path=Data, Converter={StaticResource DraggingZOrder}}"
</DataTemplate>



public class DraggingZOrderConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        ElevationModelData nData = value as ElevationModelData;
        if (nData == null)
        {
            return Double.NaN;
        }
        else // node has bound data
        {
            if (nData.Dragging)
            {
                return nData.ZIndex + 100;
            }
            else
            {
                return nData.ZIndex;
            }
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return null;
    }
}

I think you could do that, but it is more common to move the selected Nodes (and Links?) to a foreground Layer, rather than just moving them in front of Parts in the same Layer.

First define a resource like:

    <go:BooleanStringConverter x:Key="theSelectedLayerConverter" TrueString="Foreground" FalseString="" />

Then in your Node template(s) and in your Link template(s):

        go:Part.LayerName="{Binding Path=Part.IsSelected, Converter={StaticResource theSelectedLayerConverter}}"

Thank you!