Bruce,
There is a type of lag bolt or rivet under the molding that holds the fiberglass skin to the structural member in the wall, and yours has apparently rusted into. It is a common problem in all teenage or older RVs with slide outs. The trim is just trim for appearance purposes. BCS or any large motorhome body shop should be able to correct your problem in $700 to $1,000 range.
Gerald