private void ContactList_SelectionChanged(object sender, SelectionChangedEventArgs e) { LongListSelector list = sender as LongListSelector; ContactModel item = list.SelectedItem as ContactModel; this.NavigationService.Navigate(new Uri("/UserPage.xaml?msg=" + item.FullName, UriKind.Relative)); }
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) { // Avoid entering an infinite loop. if (e.AddedItems.Count == 0 || e.AddedItems[0] == null) { return; } LongListSelector lb = (LongListSelector)sender; // Navigates to the details of the first selected item. if (NavigationCommand != null) { // Gets the first selected item. object target = e.AddedItems.OfType <object>().FirstOrDefault(); // Executes the command if possible. if (NavigationCommand.CanExecute(target)) { NavigationCommand.Execute(target); } } // Clears the listbox selection. ((LongListSelector)sender).SelectedItem = null; }
private static void OnIsPivotAnimatedChanged(DependencyObject d, DependencyPropertyChangedEventArgs args) { LongListSelector list = d as LongListSelector; list.Loaded += (s2, e2) => { // locate the pivot control that this list is within Pivot pivot = list.Ancestors <Pivot>().Single() as Pivot; // and its index within the pivot int pivotIndex = pivot.Items.IndexOf(list.Ancestors <PivotItem>().Single()); bool selectionChanged = false; pivot.SelectionChanged += (s3, e3) => { selectionChanged = true; }; // handle manipulation events which occur when the user // moves between pivot items pivot.ManipulationCompleted += (s, e) => { if (!selectionChanged) { return; } selectionChanged = false; if (pivotIndex != pivot.SelectedIndex) { return; } // determine which direction this tab will be scrolling in from bool fromRight = e.TotalManipulation.Translation.X <= 0; // locate the stack panel that hosts the items VirtualizingStackPanel vsp = list.Descendants <VirtualizingStackPanel>().First() as VirtualizingStackPanel; // iterate over each of the items in view var itemsInView = list.GetVisualAncestors(); foreach (ContentPresenter item in itemsInView) { var localItem = item; list.Dispatcher.BeginInvoke(() => { var animationTargets = localItem.Descendants().Where(p => GetAnimationLevel(p) > -1); foreach (FrameworkElement target in animationTargets) { // trigger the required animation GetAnimation(target, fromRight).Begin(); } }); } }; }; }
/** * Constructor */ public ListView() { mList = new System.Windows.Controls.ListBox(); // create the LongListSelector that will be used as a segmented/alphabetical listview mLongListSelector = new LongListSelector(); mLongListSelector.Height = 500; mLongListSelector.Width = 400; // apply the predefined templates on the mLongListSelector ApplyTemplatesOnLongListSelector(); mListSections = new ObservableCollection<ListSection<ListItem>>(); // add the selection changed event handler on the mLongListSelector mLongListSelector.SelectionChanged += new SelectionChangedEventHandler(mLongListSelector_SelectionChanged); // if the default constructor is called, the list view is of type MAW_LIST_VIEW_TYPE_DEFAULT mListViewType = ListViewType.Default; View = mList; // add the tap event handler on the default list (mList) mList.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(mList_Tap); mModelToItemWidgetMap = new Dictionary<string, ListViewItem>(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (!_initialized) { // Get query string parameters var queryString = NavigationContext.QueryString; _databaseID = int.Parse(queryString["databaseID"]); // Find the pivot control _pivotControl = (Pivot)FindName("PivotControl"); if (_pivotControl != null) { _pivotControl.SelectionChanged += PivotControl_SelectionChanged; // Hook into the Tap event of each pivot item's list foreach (PivotItem pivotItem in _pivotControl.Items) { LongListSelector list = pivotItem.Content as LongListSelector; if (list == null) { continue; } list.Tap += List_Tap; } } _initialized = true; } base.OnNavigatedTo(e); }
private void ShotDetail_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { StackPanel selectorPanel = sender as StackPanel; if (selectorPanel == null) { return; } LongListSelector selectorList = null; switch (selectorPanel.Tag.ToString()) { case "Popular": selectorList = this.PopularLongSelector_LG; break; case "EveryOne": selectorList = this.EveryOneLongSelector_LG; break; case "Debuts": selectorList = this.DebutsLongSelector_LG; break; } Shot shotDetail = selectorList.SelectedItem as Shot; if (shotDetail == null) { return; } this.NavigationService.Navigate(new Uri("/Views/ShotDetailView.xaml?shotid=" + shotDetail.Id, UriKind.RelativeOrAbsolute)); }
protected virtual void OnListItemTap(DACPElement item, LongListSelector list, bool isPlayButton) { if (item is DACPItem) { RemoteUtility.HandleLibraryPlayTask(((DACPItem)item).Play()); } }
public AboutPage() { InitializeComponent(); DataContext = new About(); /* * <toolkit:LongListSelector x:Name="LLSWhatsNew" * GroupHeaderTemplate="{StaticResource LLSWhatsNewGroupHeaderTemplate}" * ItemTemplate="{StaticResource LLSWhatsNewItemTemplate}" * Margin="0,0,0,6" * ItemsSource="{Binding VersionList}"> * </toolkit:LongListSelector> */ DataTemplate dt = this.Resources["LLSWhatsNewGroupHeaderTemplate"] as DataTemplate; LongListSelector LLSWhatsNew = new LongListSelector() { Name = "LLSWhatsNew", GroupHeaderTemplate = this.Resources["LLSWhatsNewGroupHeaderTemplate"] as DataTemplate, ItemTemplate = this.Resources["LLSWhatsNewItemTemplate"] as DataTemplate, Margin = new Thickness(0, 0, 0, 6), ItemsSource = (DataContext as About).VersionList }; PivotWhatsNew.Content = LLSWhatsNew; }
public LongListSelectorHelper(LongListSelector longListSelector) { longListSelector.SelectionChanged += (sender, args) => { var methodName = GetSelectionChangedMethodName(longListSelector); var dataContext = GetMethodContext(longListSelector); if (dataContext == null) { dataContext = longListSelector.DataContext; } var method = dataContext.GetType().GetTypeInfo().GetDeclaredMethod(methodName); var parms = method.GetParameters(); if (parms != null && parms.Length == 1) { method.Invoke(dataContext, new[] { longListSelector.SelectedItem }); } else { method.Invoke(dataContext, null); } }; }
private void playlistView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (isChecked == true) { isChecked = false; return; } LongListSelector lls = sender as LongListSelector; if (lls.SelectedItem == null) { return; } var tmp = lls.SelectedItem as TrackViewModel; foreach (var track in App.AlbumVM.TrackList) { if (tmp.Location == track.Location) { currentTrack = App.AlbumVM.TrackList.IndexOf(track); } } App.TrackVM.Coppy(tmp); lls.SelectedItem = null; }
private void Photo_Loaded(object sender, ItemRealizationEventArgs e) { LongListSelector longList = sender as LongListSelector; PhotoCollectionViewModel vm = longList.DataContext as PhotoCollectionViewModel; vm.LoadMorePhotos(e.Container.Content as Photo); }
/// <summary> /// Called when [element changed]. /// </summary> /// <param name="e">The e.</param> protected override void OnElementChanged(ElementChangedEventArgs <DynamicListView <T> > e) { base.OnElementChanged(e); if (_tableView == null) { //var source = new DataSource(this); //this.tableView.ItemTemplate = new DataSource(this).ContentTemplate; _tableView = new LongListSelector(); _tableView.SelectionChanged += (sender, args) => { foreach (var item in args.AddedItems.OfType <T>()) { Element.InvokeItemSelectedEvent(this, item); } }; _tableView.ItemTemplate = Template; SetNativeControl(_tableView); } Unbind(e.OldElement); Bind(e.NewElement); }
private async void songsView_SelectionChanged(object sender, SelectionChangedEventArgs e) { LongListSelector lls = sender as LongListSelector; if (lls.SelectedItem == null) { return; } if (isProcessing == true) { return; } isProcessing = true; MessageBox.Show("Please wait for a few seconds"); AlbumViewModel tmp = new AlbumViewModel() { Title = App.ArtistVM.Name }; foreach (var track in App.ArtistVM.TrackList) { await track.GetDetailAsync(); tmp.TrackList.Add(track); } App.PlayerPlaylistArg = tmp; NavigationService.Navigate(new Uri("/Views/Player.xaml", UriKind.Relative)); isProcessing = false; lls.SelectedItem = null; }
private async void LsChannel_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { LongListSelector longListSelector = sender as LongListSelector; if (longListSelector != null) { Video selectedItem = longListSelector.get_SelectedItem() as Video; if (selectedItem != null) { if (selectedItem.Date != null) { this.ControlLoadding.set_Visibility(0); Xemvideo.Link = await GetData.GetLinkMp4Vtv(selectedItem.Url); this.ControlLoadding.set_Visibility(1); } else { Xemvideo.Link = selectedItem.Url; } Xemvideo.NameVideo = selectedItem.Title; this.get_NavigationService().Navigate(new Uri("/View/XemVideo.xaml", 0)); this.LsChannel.set_SelectedItem(null); } } }
private void openMessage(object sender, RoutedEventArgs e) { List <string> list = new List <string>(); for (int i = 0; i < 16; i++) { list.Add("Teste " + i); } LongListSelector longList = new LongListSelector(); longList.ItemTemplate = (DataTemplate)Application.Current.Resources["listContent"]; longList.ItemsSource = list; CustomMessageBox customMessageBox = new CustomMessageBox() { Title = "Hotel Urbano", Background = new SolidColorBrush(Colors.White), Foreground = new SolidColorBrush(Colors.Black), Content = longList, LeftButtonContent = "Fechar" }; customMessageBox.Show(); }
private void SelectStation(Station station) { if (station != null) { //Add station switch (_waitingForKeuze) { case PlannerKeuze.None: break; case PlannerKeuze.Van: _vm.VanStation = station; break; case PlannerKeuze.Naar: _vm.NaarStation = station; break; case PlannerKeuze.Via: _vm.ViaStation = station; break; default: break; } StationSelectorGrid.Visibility = System.Windows.Visibility.Collapsed; KeyboardPanel.Visibility = System.Windows.Visibility.Collapsed; PlannerPanel.Visibility = System.Windows.Visibility.Visible; ApplicationBar.IsVisible = true; currentSelector = null; _waitingForKeuze = PlannerKeuze.None; } }
/// <summary> /// Konstruktor. /// </summary> /// <param name="dispatcher">Der Dispatcher der Seite des LongListSelectors.</param> /// <param name="longListSelector">Der LongListSelector zum animieren.</param> internal LongListSelectorAnimator(Dispatcher dispatcher, LongListSelector longListSelector) { this.dispatcher = dispatcher; longListSelector.GroupViewOpened += LongListSelector_GroupViewOpened; longListSelector.GroupViewClosing += LongListSelector_GroupViewClosing; }
public GamesViewPage() { InitializeComponent(); if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } ListView = new LongListSelector() { ItemsSource = App.ViewModel.MainGameView.GamesList, FontWeight = FontWeights.Thin }; ListView.ItemTemplate = (DataTemplate)Resources["ListTemplate"]; GridView = new Panorama() { ItemsSource = App.ViewModel.MainGameView.GamesList, FontWeight = FontWeights.Thin }; GridView.ItemTemplate = (DataTemplate)Resources["GridTemplate"]; GridView.HeaderTemplate = (DataTemplate)Resources["PanoramaHeaderTemplate"]; BuildContentPanel(); pickBackgroundColor(); BuildLocalizedApplicationBar(); }
private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { currentPivotIndex = MainPivot.SelectedIndex; if (currentPivotIndex == 0) { focusedList = DailyGirlsList; ToggleLayoutButton(layoutStatus & 1); } else if (currentPivotIndex == 1) { focusedList = GirlsStreamList; ToggleLayoutButton((layoutStatus >> 1) & 1); // load girl stream if the stream has not been loaded. if (!isStreamLoaded) { App.ViewModel.LoadStream(++page); isStreamLoaded = true; Debug.WriteLine(DeviceStatus.ApplicationCurrentMemoryUsage + " / " + DeviceStatus.ApplicationMemoryUsageLimit); } } }
private static void OnListTap(object sender, System.Windows.Input.GestureEventArgs e) { LongListSelector list = (LongListSelector)sender; ISelectable source = GetSource(list); source.SelectedItem = list.SelectedItem; }
public LongListBottomObserver(LongListSelector longList) { this.longList = longList; longList.ItemRealized += LLS_ItemRealized; longList.ItemUnrealized += LLS_ItemUnrealized; pollingTask = new PeriodicTask(500, checkIfBottom); pollingTask.Run(); }
private void contactsList_SelectionChanged_1(object sender, SelectionChangedEventArgs e) { LongListSelector list = (sender as LongListSelector); Microsoft.Phone.UserData.Contact selectedContact = (list.SelectedItem as Microsoft.Phone.UserData.Contact); ContactManager.Instance.TempContact = selectedContact; NavigationService.Navigate(new Uri("/Views/Contact.xaml", UriKind.RelativeOrAbsolute)); }
public void Bind(ExtendedListBox listbox) { list = listbox; list.StretchingBottom += list_StretchingBottom; list.StretchingTop += list_StretchingTop; Bound = true; }
/// <summary> /// Called just before a UI element displays in an application. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); _mainItemsControl = (LongListSelector)GetTemplateChild("MainItemsControl"); Update(); }
public static void GroupViewClose(this LongListSelector list, GroupViewClosingEventArgs e) { //Cancelling automatic closing and scrolling to do it manually. e.Cancel = true; if (e.SelectedGroup != null) { list.ScrollToGroup(e.SelectedGroup); } //Dispatch the swivel animation for performance on the UI thread. Application.Current.RootVisual.Dispatcher.BeginInvoke(() => { //Construct and begin a swivel animation to pop out the group view. IEasingFunction quadraticEase = new QuadraticEase { EasingMode = EasingMode.EaseOut }; Storyboard _swivelHide = new Storyboard(); ItemsControl groupItems = e.ItemsControl; foreach (var item in groupItems.Items) { UIElement container = groupItems.ItemContainerGenerator.ContainerFromItem(item) as UIElement; if (container != null) { Border content = VisualTreeHelper.GetChild(container, 0) as Border; if (content != null) { DoubleAnimationUsingKeyFrames showAnimation = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame showKeyFrame1 = new EasingDoubleKeyFrame(); showKeyFrame1.KeyTime = TimeSpan.FromMilliseconds(0); showKeyFrame1.Value = 0; showKeyFrame1.EasingFunction = quadraticEase; EasingDoubleKeyFrame showKeyFrame2 = new EasingDoubleKeyFrame(); showKeyFrame2.KeyTime = TimeSpan.FromMilliseconds(125); showKeyFrame2.Value = 90; showKeyFrame2.EasingFunction = quadraticEase; showAnimation.KeyFrames.Add(showKeyFrame1); showAnimation.KeyFrames.Add(showKeyFrame2); Storyboard.SetTargetProperty(showAnimation, new PropertyPath(PlaneProjection.RotationXProperty)); Storyboard.SetTarget(showAnimation, content.Projection); _swivelHide.Children.Add(showAnimation); } } } _swivelHide.Completed += delegate { list.CloseGroupView(); }; _swivelHide.Begin(); }); }
private void _swivelHide_Completed(object sender, EventArgs e) { //Close group view. if (currentSelector != null) { currentSelector.CloseGroupView(); currentSelector = null; } }
public void Bind(LongListSelector listbox) { Bound = true; this.listbox = listbox; listbox.ManipulationStateChanged += listbox_ManipulationStateChanged; listbox.MouseMove += listbox_MouseMove; listbox.ItemRealized += OnViewportChanged; listbox.ItemUnrealized += OnViewportChanged; }
private void allExercisesSelector_SelectionChanged(object sender, SelectionChangedEventArgs e) { LongListSelector selector = sender as LongListSelector; //verifying our sender is actually a longlistselector if (selector == null) { return; } Exercise data = selector.SelectedItem as Exercise; //verfiying our send is actually an exercise if (data == null) { return; } bool exerciseAlreadyExists = false; foreach (Exercise exercise in App.ViewModel.ExercisesForNewTemplate) { if (exercise.ID == data.ID) { exerciseAlreadyExists = true; } } if (exerciseAlreadyExists) { var exerciseAlreadyExistsPrompt = new MessagePrompt { Title = "Error", Message = "You cannot add the same exercise to a workout twice." }; exerciseAlreadyExistsPrompt.VerticalAlignment = System.Windows.VerticalAlignment.Center; exerciseAlreadyExistsPrompt.Completed += exerciseAlreadyExistsPrompt_Completed; ChooseExercisePopUp.IsOpen = false; exerciseAlreadyExistsPrompt.Show(); } else { App.ViewModel.ExercisesForNewTemplate.Add(data); if (App.ViewModel.ExercisesForNewTemplate.Count > 0) { ExerciseHint.Visibility = Visibility.Collapsed; } ChooseExercisePopUp.IsOpen = false; ApplicationBar.IsVisible = true; TitlePanel.Opacity = 1; ContentPanel.Opacity = 1; } selector.SelectedItem = null; }
public LongListSelectorOberserver(LongListSelector lls) { this.lls = lls; viewportControl = FindViewport(lls); lls.ItemRealized += LLS_ItemRealized; lls.ItemUnrealized += LLS_ItemUnrealized; //lls.ManipulationStateChanged += LLS_ManipulationStateChanged; //lls.ManipulationDelta +=lls_ManipulationDelta; //lls.MouseMove += listbox_MouseMove; }
public void InitializeComponent() { if (this._contentLoaded) { return; } this._contentLoaded = true; Application.LoadComponent(this, new Uri("/VKClient.Common;component/UC/Picker2UC.xaml", UriKind.Relative)); this.LayoutRoot = (Grid)base.FindName("LayoutRoot"); this.listPicker = (LongListSelector)base.FindName("listPicker"); }
/** * Constructor */ public ListView() { mList = new System.Windows.Controls.ListBox(); // create the LongListSelector that will be used as a segmented/alphabetical listview mLongListSelector = new LongListSelector(); mLongListSelector.Height = 500; mLongListSelector.Width = 400; // apply the predefined templates on the mLongListSelector ApplyTemplatesOnLongListSelector(); mListSections = new ObservableCollection<ListSection<ListItem>>(); // add the selection changed event handler on the mLongListSelector mLongListSelector.SelectionChanged += new SelectionChangedEventHandler(mLongListSelector_SelectionChanged); // if the default constructor is called, the list view is of type MAW_LIST_VIEW_TYPE_DEFAULT mListViewType = ListViewType.Default; mView = mList; // add the tap event handler on the default list (mList) mList.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(mList_Tap); mModelToItemWidgetMap = new Dictionary<string, ListViewItem>(); }