You can create a UIHelper class or something and add the code there.