You will need some structure to position the solenoids above the xylophone.
The .AI file below contains a design suited for laser cutting out of 1/8" thick acrylic. If you don't have access to a laser cutter, you can use this template to cut one out of another material such as wood or cardstock, or design something new for your particular xylophone situation.
You will notice there is some wiggle room in the slots where the top bar fits in. This allows the user to precisely position the bar above the xylophone so each solenoid hits the note perfectly.