Since you have a bunch of items, it would be better to store them in an ItemGroup
from the start since after all that is what it is meant for and it also allows transformations etc. For example this achieves what you want:
<ItemGroup>
<Names Include="Anders">
<Value>True</Value>
</Names>
<Names Include="Peter">
<Value>False</Value>
</Names>
<Names Include="Michael">
<Value>False</Value>
</Names>
<Names Include="Gustaf">
<Value>True</Value>
</Names>
</ItemGroup>
<Target Name="GetNames">
<ItemGroup>
<AllNames Include="%(Names.Identity)" Condition="%(Names.Value)==true"/>
</ItemGroup>
<Message Text="@(AllNames)"/> <!--AllNames contains Anders and Gustaf-->
</Target>
However if they must be properties, I do not think there is another way than enumerating them all manually like so:
<PropertyGroup>
<Anders>True</Anders>
<Peter>False</Peter>
<Michael>False</Michael>
<Gustaf>True</Gustaf>
</PropertyGroup>
<Target Name="GetNames">
<ItemGroup>
<AllNames Include="Anders" Condition="$(Anders)==true"/>
<AllNames Include="Peter" Condition="$(Peter)==true"/>
<AllNames Include="Michael" Condition="$(Michael)==true"/>
<AllNames Include="Gustaf" Condition="$(Gustaf)==true"/>
</ItemGroup>
<Message Text="@(AllNames)"/>
</Target>