While it may be tempting, and fun, to simply try to do the puzzle as it for a while, there is a rather nice way of simplifying the problem.
By joining up each of the squares that are connected by a knights move, we can reduce the problem down to a graph, where the knights can move along connected nodes.
The graph turns out to be rather simple! All of the squares end up on a single line, with the single square 'B' branching off.
Clearly, by moving the pieces along one node at a time, the only place where any swapping can happen is at B. The quickest way would be to swap W1 and B1 , and swap W2 and B2 (otherwise there would be even more swapping. There are two ways of doing this:
Swapping W1 and B1, then W2 and B2:
Swapping W2 and B2, then W1 and B1:
So the minimum number of moves is 28.