So you ended up with something like this?
Code:
local function attach()
CastingBarFrame:ClearAllPoints()
CastingBarFrame:SetPoint("TOP",C_NamePlate.GetNamePlateForUnit("player"),"BOTTOM",0,-28)
--CastingBarFrame.SetPoint = function() end
end
local function detach()
CastingBarFrame:ClearAllPoints()
CastingBarFrame:SetPoint("TOP",UIParent,"BOTTOM",0,160)
--CastingBarFrame.SetPoint = function() end
end
local f = CreateFrame("frame")
f:RegisterEvent("NAME_PLATE_UNIT_ADDED","player")
f:SetScript("OnEvent",attach)
local f = CreateFrame("frame")
f:RegisterEvent("NAME_PLATE_UNIT_REMOVED","player")
f:SetScript("OnEvent",detach)
Haven't played around too much with it, since it won't solve the cast bar stretching problem. Would be nice if someone else would chime in, but otherwise your other suggestions work ok for now.