When a preposition is part of a phrasal verb (e.g., bring up, call off, do over, to drop out of, tired of), many do not classify it is a preposition but, rather unhelpfully, some do. So, it depends which side of the debate you're on.
Prepositions typically sit before nouns. The word trying in your example is a gerund (a type of noun).