You're going to have a very hard time finding help with XML. Relying heavily on XML is discouraged for various reasons, and there is only one thing XML can do that pure LUA cannot: creating secure templates.
You could give your frame an OnClick script, that checks for the button, and toggle frame locking that way.
Lua Code:
local frame = CreateFrame("Button", MyReallyNeatFrameName, UIParent)
frame:RegisterForClicks("AnyUp")
frame:SetScript("OnClick", function(self, button, ...)
if (button == "RightButton" or "MiddleButton") then
-- Execute whatever method you'd choose for locking your frame.
end
end)