Reputation: 37
I want to display a button, when I tap a long list selector in 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)
{}
xaml code
<phone:LongListSelector FontSize="50" Foreground="Gray" Tap="LongListSelector_Tap_1" ItemsSource="{Binding}" Margin="0,77,0,0" />
Upvotes: 1
Views: 173
Reputation: 788
User Visibility
property to hide your list and show the Button
.
Your XAML
will look something like bellow:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" >
<phone:LongListSelector x:Name="LongList" Tap="LongListTap"/>
<Button x:Name="ActionButton" Visibility="Collapsed"/>
</Grid>
And event handler:
private void LongListTap(object sender, GestureEventArgs e)
{
LongList.Visibility = Visibility.Collapsed;
ActionButton.Visibility = Visibility.Visible;
}
Upvotes: 1
Reputation: 9242
what you have to this just set the visibilty of your button to visible like suppose your buttn name is "Mybutton" ..
private void LongListSelector_Tap_1(object sender,GestureEventArgs e)
{
Mybutton.Visibility = Visibility.visible;
}
Upvotes: 0