Preheat the oven to 375°F and lightly grease a 9x13 baking dish.
Melt the butter in a saucepan over medium heat. Add the chopped onion and cook until softened.
Stir in the flour and cook for one minute. Slowly whisk in the milk until the sauce thickens.
Add the salt and pepper to the sauce and remove the pan from the heat.
Layer half the sliced potatoes and half the diced ham in the baking dish. Pour half the sauce over the top.
Repeat with the remaining potatoes and ham, then pour the rest of the sauce over everything.
Sprinkle the shredded cheddar cheese and breadcrumbs evenly across the surface.
Bake uncovered for 45 minutes, or until the potatoes are tender when pierced with a fork.