Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void ListBox_Places_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- ListBox listbox = sender as ListBox;
- if(listbox.SelectedIndex < 0) return;
- // ดึงค่า item ที่ถูกเลือก มาจาก listbox
- Place item = listbox.SelectedItem as Place;
- // เลื่อน pivot ให้กลับไปยังหน้า map
- PivotRoot.SelectedIndex = 0;
- Image_Dest_Icon.Source = new BitmapImage(new Uri(item.image, UriKind.Relative));
- TextBlock_Dest_Name.Text = item.name;
- PushPin_Dest.Location = item.location;
- ApplicationBarIconButton ApplicationBarButton_Direction = ApplicationBar.Buttons[0] as ApplicationBarIconButton;
- // เลื่อน map ให้ครอบคลุมทั้งสองจุด
- if (PushPin_Me.Visibility == System.Windows.Visibility.Visible)
- {
- ApplicationBarButton_Direction.IsEnabled = true;
- Map_Main.ZoomLevel -= 0.5;
- Map_Main.SetView(LocationRect.CreateLocationRect(PushPin_Dest.Location, PushPin_Me.Location));
- }
- else
- {
- Map_Main.Center = PushPin_Dest.Location;
- Map_Main.ZoomLevel = 15;
- ApplicationBarButton_Direction.IsEnabled = false;
- }
- // แสดง pushpin
- PushPin_Dest.Visibility = System.Windows.Visibility.Visible;
- listbox.SelectedIndex = -1;
- }
Add Comment
Please, Sign In to add comment