magento2 – Magento 2: Implement the function columnControls (hide / show) in a user-defined administrator grid

Here I created a user-defined grid (within admin) with block. Now I want to add the controlColumns (Hide / Show) function to this custom grid.
With the Ui component, it's easy to add this functionality using the following code (on the grid list page):


But I want to put this functionality in a custom grid that is created with block.

I am also attaching an image file related to this problem.

Enter the image description here

Please give me an idea how I can achieve it. Any help is appreciated.