If your under warranty I agree with Vikingstaff, let the dealer worry about it.
I'm no expert, but here's my $.02 and what I'd do before paying someone to look at it.
Different engines have different types of systems, but generally speaking the trim sending unit is always subject to corrosion because they are low on the mid-section and get wet all the time.
First I'd check if it works right. Loosen the two adjustment screws and rotate the sensor both ways. Does the gauge sweep smooth both ways and seem right? If not, I'd suspect the sending unit and replace it. If you buy one make sure you get the right one, do you have a digital or analog trim sensor? Analog = old school trim gauge, Digital if you have Smartcraft or DTS.
If the sending unit sweeps the gauge nice and smooth both ways I'd think it was good. To adjust it, trim the engine down all the way and then rotate the sending unit so the gauge shows right at full down position and snug adjusting screws down.
Next look at the wires and any connections. Are the wires corroded or broken anywhere? There is a specific way they are routed so they don't get pinched when trimming the engine, make sure someone didn't mess with them and they are getting pinched somewhere. Follow them up under the cowl and look for corrosion, smashed or broken wires. If you don't see anything I'd make sure the wires are tight on the back of the gauge and again look for any smashed/pinched wires under the dash.