In the primaries, yes. This is to choose the candidates for a specific party, so it makes sense that you're not voting for an opposing party's candidate. However, in any other election, no. A citizen doesn't need to belong to a political party to vote.