It's because you put the resource in PhoneApplicationPage's resources, but you are trying to pull it from the application reources.
Either put your style in the Application resources (App.xaml for a wpf application, don't know about a windows phone app), or reference the correct resources.
Assuming the code behind is in PhoneApplicationPage, it should be:
tg.Style = this.Resources["TopinsStyle"] as Style;