示例#1
0
        // Sample code for building a localized ApplicationBar
        //private void BuildLocalizedApplicationBar()
        //{
        //    // Set the page's ApplicationBar to a new instance of ApplicationBar.
        //    ApplicationBar = new ApplicationBar();

        //    // Create a new button and set the text value to the localized string from AppResources.
        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        //    appBarButton.Text = AppResources.AppBarButtonText;
        //    ApplicationBar.Buttons.Add(appBarButton);

        //    // Create a new menu item with the localized string from AppResources.
        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
        //}

        private void LlsPods_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var listbox = sender as LongListSelector;

            if (listbox == null || listbox.SelectedItem as PodViewModel == null)
            {
                return;
            }

            var dh = new DialogService();

            var detailsView = new DetailsView();

            var selectedItem = (listbox.SelectedItem as PodViewModel).Clone();

            detailsView.SetContext(selectedItem);

            dh.Child = detailsView;

            dh.Opened += delegate {
                ApplicationBar.IsVisible = false;
            };

            dh.Closed += delegate {
                ApplicationBar.IsVisible = true;
            };

            dh.AnimationType = DialogService.AnimationTypes.Slide;

            ThreadPool.QueueUserWorkItem(delegate
            {
                Dispatcher.BeginInvoke(dh.Show);
            });

            listbox.SelectedItem = null;
        }