Reputation: 123
If´ve got a xaml-view, which gets some values from a list (from a DB throw a rest-service). so there are some parameters like "id", "phone number" or "adress". Evrybody has an ID, sometimes a phoneNo, sometimes Address or both. now i want to view a list, with the ID, but only with "people" which has got an phone number. that for, i´ve got a listview, in which i´m binding the phone number f.e.:
...<viewcell x:Name="people">
<Label Text="ID: "/>
<Label Text="{Binding ID}"/>
<Label Text="PhoneNo: "/>
<Label Text="{Binding PhoneNr}"/>
</viewcell>...
this is where i set the itemsource:
people.ItemsSource = retList;
so, as you can see, i will get a list, where all people are listed, sometimes there are phonenumbers, sometimes this field is empty. but i wonly want the peoble with an phonenumber in my list. is this possible? thanks a lot
Upvotes: 0
Views: 167
Reputation: 2299
Use this:
var phonesList = retList.Where(p => !string.IsNullOrEmpty(p.PhoneNr)).ToList();
Upvotes: 1