I'm not sure this is the best way to reach desired behavior. I'd implement user control with all needed logic and use it within the transformation.
Transformation is a tool to present data. Any logic should be implemented in code behind, unless this is really simple ui feature.