Yes! :)
For flaps, you can assign it to do precisely what you said; I personally recommend using a "two-button" switch if available, but using two buttons for there purpose of notches is fine.
For trim, I believe the same applies, though I have not tried it myself.
Button mapping is visually a littler different than FSX, but in my experience, I find that the X-Plane mapping is more sophisticated than that of FSX. More customizability.