当我在 windows phone 8 中点击一个长列表选择器时,我想显示一个按钮。
C#
this.DisplayedContacts = new ObservableCollection<string>();
this.DataContext = this.DisplayedContacts;
var contacts = new Contacts();
contacts.SearchCompleted += (s, e) =>
{
foreach (var contact in e.Results)
{
Debug.WriteLine(contact.PhoneNumbers.Any()? contact.PhoneNumbers.First().PhoneNumber: string.Empty);
this.DisplayedContacts.Add(contact.DisplayName + " - " +
(contact.PhoneNumbers.Any()
? contact.PhoneNumbers.First().PhoneNumber
: string.Empty));
}
};
contacts.SearchAsync(string.Empty, FilterKind.DisplayName, null);
}
public ObservableCollection<string> DisplayedContacts { get; set; }
private void LongListSelector_Tap_1(object sender,GestureEventArgs e)
{}
xml代码
<phone:LongListSelector FontSize="50" Foreground="Gray" Tap="LongListSelector_Tap_1" ItemsSource="{Binding}" Margin="0,77,0,0" />