kind of like this, the widget on the left is a button and the widget on the right is a image, what i want to do is whenever i press the button it will cast to the image widget however i dont know how to
I sense confusion regarding what casting is. What are you trying to do, exactly? Press a button and change the image?
There is no need to cast anything - you already know the type of the object you want to interact with. One is a button and the other one an image. Casting can be useful if you did not know that.