Drag the block to your screen and define an event handler to the VisibilityChange event to apply the logic according to the visibility flag.