Match Case Grouping

Is it possible to accomplish the same thing with UX the way we handle javascript switch case like the following:

switch(id){
	case "1":
	case "2":
		doSomething();
		break;
	case "3":
		doSomethingElse();
		break;
	default:
		doSleep();
}

This is because I have several ui groups based on an id like in the following:

<Match String="{id}">
	<Case String="1">
		<Panel>
			<Text Value="Display UI for One" />
		</Panel>
	</Case>
	<Case String="2">
		<StackPanel>
			<mob.IconAccount />
		</StackPanel>
	</Case>
	<Case String="3">
		<Panel>
			<Text Value="Display UI for Three" />
		</Panel>
	</Case>
	<Case String="4">
		<DockPanel>
			<mob.IconAccount />
			<Text Value="{name}" />
		</DockPanel>
	</Case>
</Match>

Using IsDefault will not be enough as it only handles one group that share the same UI traits. What I am trying to avoid is having to duplicate the same UI over and over again under different cases. I have about 8 cases to handle.

MatchKey!

You will want to use Each with MatchKey which allows you to match on a given property in your list items and make use of templates (see the second example in the link).

Match/Case combo is much more memory intensive and should be avoided.

Thanks for the tip Uldis. I kind of noticed the performance issue when I ran it in my android phone. Initially, I was under the impression that MatchKey is doing the same thing but now I think I know the trick.