/// <summary> /// We will visualize the data item in asynchronously in multiple phases for improved panning user experience /// of large lists. In this sample scneario, we will visualize different parts of the data item /// in the following order: /// /// 1) Placeholders (visualized synchronously - Phase 0) /// 2) Tilte (visualized asynchronously - Phase 1) /// 3) Category and Image (visualized asynchronously - Phase 2) /// /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void ItemGridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { ItemViewer iv = args.ItemContainer.ContentTemplateRoot as ItemViewer; if (args.InRecycleQueue == true) { iv.ClearData(); } else if (args.Phase == 0) { iv.ShowPlaceholder(args.Item as Item); // Register for async callback to visualize Title asynchronously args.RegisterUpdateCallback(ContainerContentChangingDelegate); } else if (args.Phase == 1) { iv.ShowTitle(); args.RegisterUpdateCallback(ContainerContentChangingDelegate); } else if (args.Phase == 2) { iv.ShowCategory(); iv.ShowImage(); } // For imporved performance, set Handled to true since app is visualizing the data item args.Handled = true; }
private void UpdateRunningAverageContainerHeight(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.ItemContainer != null && !args.InRecycleQueue) { switch (args.Phase) { case 0: // use the size of the very first placeholder as a starting point until // we've seen the first item if (this.averageContainerHeight == 0) { this.averageContainerHeight = args.ItemContainer.DesiredSize.Height; } args.RegisterUpdateCallback(1, this.UpdateRunningAverageContainerHeight); args.Handled = true; break; case 1: // set the content args.ItemContainer.Content = args.Item; args.RegisterUpdateCallback(2, this.UpdateRunningAverageContainerHeight); args.Handled = true; break; case 2: // refine the estimate based on the item's DesiredSize this.averageContainerHeight = (this.averageContainerHeight * itemsSeen + args.ItemContainer.DesiredSize.Height) / ++itemsSeen; args.Handled = true; break; } //HARDCODED Container height because I do not know how to find the actual average (waiting until the image loads) this.averageContainerHeight = 500; } }
// Load listview contents in stages for user-responsiveness private void lstNodes_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { ItemViewerNode iv = args.ItemContainer.ContentTemplateRoot as ItemViewerNode; if (args.InRecycleQueue == true) { iv.ClearData(); } else if (args.Phase == 0) { iv.ShowPlaceholder(args.Item as Node); args.RegisterUpdateCallback(ContainerContentChangingDelegateNodes); } else if (args.Phase == 1) { iv.ShowId(); args.RegisterUpdateCallback(ContainerContentChangingDelegateNodes); } else if (args.Phase == 2) { iv.ShowLocation(); } args.Handled = true; }
/// <summary> /// We will visualize the data item in asynchronously in multiple phases for improved panning user experience /// of large lists. In this sample scneario, we will visualize different parts of the data item /// in the following order: /// /// 1) Placeholders (visualized synchronously - Phase 0) /// 2) Labels (visualized asynchronously - Phase 1) /// 3) Values (visualized asynchronously - Phase 2) /// /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void Items_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { TeamsDrillDownItem iv = args.ItemContainer.ContentTemplateRoot as TeamsDrillDownItem; if (args.InRecycleQueue == true) { iv.ClearData(); } else if (args.Phase == 0) { iv.ShowPlaceholder(args.Item as TeamsDrillDownViewModel); // Register for async callback to visualize Title asynchronously args.RegisterUpdateCallback(ContainerContentChangingDelegate); } else if (args.Phase == 1) { iv.ShowLabels(); args.RegisterUpdateCallback(ContainerContentChangingDelegate); } else if (args.Phase == 2) { iv.ShowValues(); args.RegisterUpdateCallback(ContainerContentChangingDelegate); } // For improved performance, set Handled to true since app is visualizing the data item args.Handled = true; }
/// <summary> /// グリッドビューのアイテム変更状態変更イベント /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void gridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.Phase == 0) { if (m_scrollPosition.HasValue) { gridView.ScrollToVerticalOffset(m_scrollPosition.Value); if (m_scrollPosition.Value == 0 || gridView.VerticalOffset != 0) { m_scrollPosition = null; args.RegisterUpdateCallback(1, gridView_ContainerContentChanging); } else { //スクロール位置が設定できなかったのでもう一度試す args.RegisterUpdateCallback(0, gridView_ContainerContentChanging); } } else { args.RegisterUpdateCallback(1, gridView_ContainerContentChanging); } } else if (args.Phase == 1) { CommonPageManager.OnGridContentChanging(args.Item as FolderListItem, args.InRecycleQueue); } args.Handled = true; }
// Load listview contents in stages for user-responsiveness private void lstFireflies_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { ItemViewerFirefly iv = args.ItemContainer.ContentTemplateRoot as ItemViewerFirefly; if (args.InRecycleQueue == true) { iv.ClearData(); } else if (args.Phase == 0) { iv.ShowPlaceholder(args.Item as Firefly); args.RegisterUpdateCallback(ContainerContentChangingDelegateFireflies); } else if (args.Phase == 1) { iv.ShowId(); args.RegisterUpdateCallback(ContainerContentChangingDelegateFireflies); } else if (args.Phase == 2) { iv.ShowAttribute(); } args.Handled = true; }
private void UpdateRunningAverageContainerHeight(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.ItemContainer != null && args.InRecycleQueue != true) { if (args.Phase == 0) { // use the size of the very first placeholder as a starting point until // we've seen the first item if (this.averageContainerHeight == 0) { this.averageContainerHeight = args.ItemContainer.DesiredSize.Height; } args.RegisterUpdateCallback(1, this.UpdateRunningAverageContainerHeight); args.Handled = true; } else if (args.Phase == 1) { // set the content args.ItemContainer.Content = args.Item; args.RegisterUpdateCallback(2, this.UpdateRunningAverageContainerHeight); args.Handled = true; } else if (args.Phase == 2) { // refine the estimate based on the item's DesiredSize this.averageContainerHeight = (this.averageContainerHeight * itemsSeen + args.ItemContainer.DesiredSize.Height) / ++itemsSeen; args.Handled = true; } } }
async void JobsList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { QueueJob queueJob = args.ItemContainer.ContentTemplateRoot as QueueJob; if (args.InRecycleQueue == true) { queueJob.ClearData(); } else if (args.Phase == 0) { //This is where the queueJob gets passed the Job object queueJob?.ShowPlaceholder(args.Item as Job); args.RegisterUpdateCallback(ContainerContentChangingDelegate); } else if (args.Phase == 1) { queueJob?.ShowTitle(); args.RegisterUpdateCallback(ContainerContentChangingDelegate); } else if (args.Phase == 2) { await ViewModel.UpdateQueueOrder(); queueJob?.ShowCategory(); queueJob?.ShowImage(); } args.Handled = true; }
private void ItemListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var songViewer = args.ItemContainer.ContentTemplateRoot as SongViewer; if (songViewer == null) { return; } if (args.InRecycleQueue) { songViewer.ClearData(); } else { switch (args.Phase) { case 0: songViewer.ShowPlaceholder(args.Item as Song); args.RegisterUpdateCallback(ContainerContentChangingDelegate); break; case 1: songViewer.ShowTitle(); args.RegisterUpdateCallback(ContainerContentChangingDelegate); break; case 2: songViewer.ShowRest(); break; } } args.Handled = true; }
private void FileList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (!args.InRecycleQueue) { // This resizes the items after the item template has been changed and reloaded if (itemTemplateChanging) { itemTemplateChanging = false; Behaviors.StretchedGridViewItems.ResizeItems(FileList); } InitializeDrag(args.ItemContainer); if (args.Item is ListedItem item && !item.ItemPropertiesInitialized) { args.ItemContainer.PointerPressed += FileListGridItem_PointerPressed; args.RegisterUpdateCallback(3, async(s, c) => { item.ItemPropertiesInitialized = true; await ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(item, currentIconSize); }); } else if (args.Item is ListedItem item1 && item1.ItemPropertiesInitialized && !item1.LoadFileIcon) { args.RegisterUpdateCallback(3, async(s, c) => { await ParentShellPageInstance.FilesystemViewModel.LoadItemThumbnail(item1, currentIconSize); }); } }
private void HotCollection_OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var view = args.ItemContainer.ContentTemplateRoot as HotCollectionView; if (view == null) { return; } if (args.InRecycleQueue == true) { view.Clear(); } else { switch (args.Phase) { case 0: view.ShowPlaceHolder(args.Item as HotCollection); args.RegisterUpdateCallback(CollectionChanging); break; case 1: view.ShowTitle(); args.RegisterUpdateCallback(CollectionChanging); break; case 2: view.ShowDescription(); args.RegisterUpdateCallback(CollectionChanging); break; case 3: view.ShowAvator(); view.ShowAuthor(); args.RegisterUpdateCallback(CollectionChanging); break; case 4: view.ShowCount(); view.RegistEventHandler(_hotCollectionTapped); break; } } args.Handled = true; }
private void Activity_OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var view = args.ItemContainer.ContentTemplateRoot as ActivityView; if (view == null) { return; } if (args.InRecycleQueue == true) { view.Clear(); } else if (args.Phase == 0) { view.ShowPlaceholder(args.Item as Activity); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 1) { view.ShowTitle(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 2) { view.ShowSummary(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 3) { view.ShowAuthor(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 4) { view.ShowVerb(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 5) { view.ShowAvatar(); view.RegistEventHandler(this._authorTapped, this._titleTapped, this._summaryTapped); } args.Handled = true; }
internal void PhaseLoad(ListViewBase sender, ContainerContentChangingEventArgs args) { if (!args.InRecycleQueue) { switch (args.Phase) { case 0: { plainTextControl.Visibility = Windows.UI.Xaml.Visibility.Collapsed; markdownControl.Visibility = Windows.UI.Xaml.Visibility.Collapsed; markdownControl.Markdown = null; args.Handled = true; args.RegisterUpdateCallback(PhaseLoad); break; } case 1: { plainTextControl.Visibility = Windows.UI.Xaml.Visibility.Visible; if (args.Item is MessageActivityViewModel) plainTextControl.Text = ((MessageActivityViewModel)args.Item).Body; args.Handled = true; args.RegisterUpdateCallback(PhaseLoad); break; } case 2: { if (args.Item is MessageActivityViewModel) { var body = ((MessageActivityViewModel)args.Item).Body; args.Handled = true; var markdownBody = SnooStreamViewModel.MarkdownProcessor.Process(body); if (!SnooStreamViewModel.MarkdownProcessor.IsPlainText(markdownBody)) { plainTextControl.Visibility = Windows.UI.Xaml.Visibility.Collapsed; plainTextControl.Text = ""; markdownControl.Visibility = Windows.UI.Xaml.Visibility.Visible; markdownControl.Markdown = markdownBody.MarkdownDom as SnooDom.SnooDom; } } break; } } } else { } }
private void Recommend_OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var view = args.ItemContainer.ContentTemplateRoot as EditorRecommendView; if (view == null) { return; } if (args.InRecycleQueue == true) { view.Clear(); } else { switch (args.Phase) { case 0: view.ShowPlaceHolder(args.Item as EditorRecommend); args.RegisterUpdateCallback(RecommendChanging); break; case 1: view.ShowTitle(); args.RegisterUpdateCallback(RecommendChanging); break; case 2: view.ShowSummary(); args.RegisterUpdateCallback(RecommendChanging); break; case 3: view.ShowVoteCount(); args.RegisterUpdateCallback(RecommendChanging); break; case 4: view.ShowAvatar(); view.RegisteEventHandler(_recommendTitleTapped, _recommendSummaryTapped, _recommendAuthorTapped); break; } args.Handled = true; } }
private void Column_OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var view = args.ItemContainer.ContentTemplateRoot as ColumnView; if (view == null) { return; } if (args.InRecycleQueue == true) { view.Clear(); } else if (args.Phase == 0) { view.ShowPlaceHolder(args.Item as Column); args.RegisterUpdateCallback(ColumnChanging); } else if (args.Phase == 1) { view.ShowTitle(); args.RegisterUpdateCallback(ColumnChanging); } else if (args.Phase == 2) { view.ShowHeadline(); args.RegisterUpdateCallback(ColumnChanging); } else if (args.Phase == 3) { view.ShowArticlsCount(); args.RegisterUpdateCallback(ColumnChanging); } else if (args.Phase == 4) { view.ShowAvatar(); args.RegisterUpdateCallback(ColumnChanging); } else if (args.Phase == 5) { view.RegistEventHandler(this.ColumnTapped); } args.Handled = true; }
private void Activity_OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var view = args.ItemContainer.ContentTemplateRoot as TopicActivityView; if (view == null) { return; } if (args.InRecycleQueue == true) { view.Clear(); } else if (args.Phase == 0) { view.ShowPlaceholder(args.Item as TopicActivity); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 1) { view.ShowTitle(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 2) { view.ShowAnswer1(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 3) { view.ShowAnswer2(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 4) { view.ShowAnswer3(); args.RegisterUpdateCallback(ActivityChanging); } else if (args.Phase == 5) { view.RegistEventHandler(this.QuestionTapped, this.AnswerTapped); } args.Handled = true; }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.InRecycleQueue) { return; } var content = args.ItemContainer.ContentTemplateRoot as Grid; var member = args.Item as ChatMember; var user = _cacheService.GetMessageSender(member.MemberId) as User; if (user == null) { return; } if (args.Phase == 0) { var title = content.Children[1] as TextBlock; title.Text = user.GetFullName(); } else if (args.Phase == 2) { var photo = content.Children[0] as ProfilePicture; photo.SetUser(_protoService, user, 32); } if (args.Phase < 2) { args.RegisterUpdateCallback(OnContainerContentChanging); } args.Handled = true; }
private void AnswerContent_OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var view = args.ItemContainer.ContentTemplateRoot as ParagraphView; if (view == null) { return; } if (args.InRecycleQueue == true) { view.Clear(); } else if (args.Phase == 0) { view.ShowPlaceholder(args.Item as ParagraphModel); args.RegisterUpdateCallback(CotentChanging); } else if (args.Phase == 1) { view.Show(); } args.Handled = true; }
private void gridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { // 交由我处理吧(不用系统再处理了) args.Handled = true; // 第 1 阶段绘制 // args.Phase.ToString(); // 0 StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot; Rectangle placeholderRectangle = (Rectangle)templateRoot.FindName("placeholderRectangle"); TextBlock lblName = (TextBlock)templateRoot.FindName("lblName"); TextBlock lblAge = (TextBlock)templateRoot.FindName("lblAge"); TextBlock lblIsMale = (TextBlock)templateRoot.FindName("lblIsMale"); // 显示自定义占位符(也可以不用这个,而是直接显示 item 的背景) placeholderRectangle.Opacity = 1; // 除了占位符外,所有 item 全部暂时不绘制 lblName.Opacity = 0; lblAge.Opacity = 0; lblIsMale.Opacity = 0; // 开始下一阶段的绘制 args.RegisterUpdateCallback(ShowName); }
// Display each item incrementally to improve performance. private void MyGridView_ContainerContentChanging( ListViewBase sender, ContainerContentChangingEventArgs args) { args.Handled = true; if (args.Phase != 0) { throw new Exception("Not in phase 0."); } // First, show the items' placeholders. StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot; Rectangle placeholderRectangle = (Rectangle)templateRoot.FindName("placeholderRectangle"); TextBlock titleTextBlock = (TextBlock)templateRoot.FindName("titleTextBlock"); TextBlock subtitleTextBlock = (TextBlock)templateRoot.FindName("subtitleTextBlock"); TextBlock descriptionTextBlock = (TextBlock)templateRoot.FindName("descriptionTextBlock"); // Make the placeholder rectangle opaque. placeholderRectangle.Opacity = 1; // Make everything else invisible. titleTextBlock.Opacity = 0; subtitleTextBlock.Opacity = 0; descriptionTextBlock.Opacity = 0; // Show the items' titles in the next phase. args.RegisterUpdateCallback(ShowTitle); }
private void RenderButton(ListViewBase sender, ContainerContentChangingEventArgs args) { ButtonInit(args.Item as Topic); ButtonContainer.Opacity = 1; args.RegisterUpdateCallback(RenderTag); }
private void FileList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (!args.InRecycleQueue) { InitializeDrag(args.ItemContainer); args.ItemContainer.PointerPressed -= FileListListItem_PointerPressed; args.ItemContainer.PointerPressed += FileListListItem_PointerPressed; if (args.Item is ListedItem item && !item.ItemPropertiesInitialized) { args.RegisterUpdateCallback(3, async(s, c) => { await ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(item, 24); }); } } else { UninitializeDrag(args.ItemContainer); args.ItemContainer.PointerPressed -= FileListListItem_PointerPressed; if (args.Item is ListedItem item) { ParentShellPageInstance.FilesystemViewModel.CancelExtendedPropertiesLoadingForItem(item); } } }
private void RenderTag(ListViewBase sender, ContainerContentChangingEventArgs args) { TagInit(args.Item as Topic); TagList.Opacity = 1; args.RegisterUpdateCallback(RenderBody); }
public void RenderContainer(ContainerContentChangingEventArgs args) { CoverContainer.Opacity = 0; InfoContainer.Opacity = 0; args.RegisterUpdateCallback(RenderInfo); }
// Display each item incrementally to improve performance. private void myCraftPlanList_ContainerContentChanging( ListViewBase sender, ContainerContentChangingEventArgs args) { args.Handled = true; if (args.Phase != 0) { throw new Exception("Not in phase 0."); } // First, show the items' placeholders. StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot; Rectangle placeholderRectangle = (Rectangle)templateRoot.FindName("placeholderRectangle"); TextBlock itemNameBlock = (TextBlock)templateRoot.FindName("itemNameBlock"); TextBlock itemRarityNameBlock = (TextBlock)templateRoot.FindName("itemRarityNameBlock"); TextBlock itemTypeNameBlock = (TextBlock)templateRoot.FindName("itemTypeNameBlock"); // Make the placeholder rectangle opaque. placeholderRectangle.Opacity = 1; // Make everything else invisible. itemNameBlock.Opacity = 0; itemRarityNameBlock.Opacity = 0; itemTypeNameBlock.Opacity = 0; // Show the items name in the next phase. args.RegisterUpdateCallback(ShowItemName); }
private async void ToRender_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var root = args.ItemContainer.ContentTemplateRoot as FrameworkElement; var image = root.FindName("cover") as ImageBrush; var vm = args.Item as AlbumViewmodel; if (args.Phase == 0) { var oldCancel = root.Tag as CancellationTokenSource; if (oldCancel != null) { oldCancel.Cancel(); oldCancel.Dispose(); } var cancel = new CancellationTokenSource(); args.RegisterUpdateCallback(this.ToRender_ContainerContentChanging); root.Tag = cancel; image.Opacity = 0; } else if (args.Phase == 1) { var cancel = root.Tag as CancellationTokenSource; var imageSource = await vm.LoadCoverAsync(cancel.Token); if (!cancel.IsCancellationRequested) { image.ImageSource = imageSource; image.Opacity = 1; } } args.Handled = true; }
public void UpdateUser(IProtoService protoService, ContainerContentChangingEventArgs args, TypedEventHandler <ListViewBase, ContainerContentChangingEventArgs> callback) { var user = args.Item as User; if (user == null) { return; } if (args.Phase == 0) { TitleLabel.Text = user.GetFullName(); } else if (args.Phase == 1) { SubtitleLabel.Text = LastSeenConverter.GetLabel(user, false); } else if (args.Phase == 2) { Photo.Source = PlaceholderHelper.GetUser(protoService, user, 36); } if (args.Phase < 2) { args.RegisterUpdateCallback(callback); } args.Handled = true; }
private void OnContainerContentChangingCallback(ListViewBase sender, ContainerContentChangingEventArgs e) { UIElement contentTemplateRoot = e.ItemContainer.ContentTemplateRoot; ElementCacheRecord elementCacheRecord; if (this.elementCache.TryGetValue(contentTemplateRoot, out elementCacheRecord)) { int phaseIndex = elementCacheRecord.Phases.BinarySearch((int)e.Phase); if (phaseIndex >= 0) { foreach (PhasedElementRecord phasedElementRecord in elementCacheRecord.ElementsByPhase[phaseIndex]) { phasedElementRecord.ThawAndShow(); } phaseIndex++; } else { // don't know why this phase was not found, but by BinarySearch rules, ~phaseIndex is the place // where it would be inserted, thus the item there has the next higher number. phaseIndex = ~phaseIndex; } if (phaseIndex < elementCacheRecord.Phases.Count) { e.RegisterUpdateCallback((uint)elementCacheRecord.Phases[phaseIndex], this.OnContainerContentChangingCallback); } } }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var content = args.ItemContainer.ContentTemplateRoot as Grid; var user = args.Item as User; content.Tag = user; if (args.Phase == 0) { var title = content.Children[1] as TextBlock; title.Text = user.GetFullName(); } else if (args.Phase == 1) { var subtitle = content.Children[2] as TextBlock; subtitle.Text = string.IsNullOrEmpty(user.PhoneNumber) ? Strings.Resources.NumberUnknown : PhoneNumber.Format(user.PhoneNumber); } else if (args.Phase == 2) { var photo = content.Children[0] as ProfilePicture; photo.Source = PlaceholderHelper.GetUser(ViewModel.ProtoService, user, 36); } if (args.Phase < 2) { args.RegisterUpdateCallback(OnContainerContentChanging); } args.Handled = true; }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.InRecycleQueue) { return; } var content = args.ItemContainer.ContentTemplateRoot as StackPanel; var user = args.Item as User; if (args.Phase == 0) { var title = content.Children[1] as TextBlock; title.Text = user.GetFullName(); } else if (args.Phase == 2) { var photo = content.Children[0] as ProfilePicture; photo.Source = PlaceholderHelper.GetUser(_protoService, user, 48); } if (args.Phase < 2) { args.RegisterUpdateCallback(OnContainerContentChanging); } args.Handled = true; }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.InRecycleQueue) { return; } var content = args.ItemContainer.ContentTemplateRoot as Grid; var chat = args.Item as Chat; if (args.Phase == 0) { var title = content.Children[1] as TextBlock; title.Text = ViewModel.ProtoService.GetTitle(chat); } else if (args.Phase == 1) { } else if (args.Phase == 2) { var photo = content.Children[0] as ProfilePicture; photo.Source = PlaceholderHelper.GetChat(ViewModel.ProtoService, chat, 36); } if (args.Phase < 2) { args.RegisterUpdateCallback(OnContainerContentChanging); } args.Handled = true; }
private void Episodesitem_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { ItemDetailsList item = args.ItemContainer.ContentTemplateRoot as ItemDetailsList; args.RegisterUpdateCallback((s, e) => item.LoadImage()); args.Handled = true; }
private static void ListViewContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { // We need to leave this as false, otherwise data binding will not work args.Handled = false; bool hasMore = PerformNextPhase(args); if (hasMore) { args.RegisterUpdateCallback(ListViewContainerContentChanging); } }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { switch (args.Phase) { case 0: args.RegisterUpdateCallback(OnContainerContentChanging); break; case 1: ApplyPhaseOne(args); args.RegisterUpdateCallback(OnContainerContentChanging); break; case 2: ApplyPhaseTwo(args); break; default: break; } // Set args.Handled = true if using x:Bind to skip apply DataContext args.Handled = true; }
private void ItemListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var songViewer = args.ItemContainer.ContentTemplateRoot as SongViewer; if (songViewer == null) return; if (args.InRecycleQueue) { songViewer.ClearData(); } else switch (args.Phase) { case 0: songViewer.ShowPlaceholder((args.Item as QueueSong).Song, true); args.RegisterUpdateCallback(ContainerContentChangingDelegate); break; case 1: songViewer.ShowTitle(); args.RegisterUpdateCallback(ContainerContentChangingDelegate); break; case 2: songViewer.ShowRest(); break; } // For imporved performance, set Handled to true since app is visualizing the data item args.Handled = true; }
private void GridScreenshots_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { args.Handled = true; if (args.Phase != 0) { throw new Exception("Not in phase 0."); } StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot; Image appIcon = (Image)templateRoot.FindName("appScreenshots"); appIcon.Opacity = 0; args.RegisterUpdateCallback(ShowImages); }
private void Phase1Callback(ListViewBase sender, ContainerContentChangingEventArgs args) { var prev = GetPreview(args); if (prev != null) { prev.Phase = 1; args.RegisterUpdateCallback(Phase2Callback); } }
private void myGridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { Sleep(1); if (args.Phase < 10) args.RegisterUpdateCallback(myGridView_ContainerContentChanging); }
private void ListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { Grid templateRoot = (Grid)args.ItemContainer.ContentTemplateRoot; args.RegisterUpdateCallback(ShowText); }
private void ShowTasksDueTime(ListViewBase sender, ContainerContentChangingEventArgs args) { args.Handled = true; if (args.Phase != 2) { throw new Exception("not in phrase 0"); } Border borderTasksRoot = args.ItemContainer.ContentTemplateRoot as Border; TextBlock txtTasksDueTime = borderTasksRoot.FindName("txtTasksDueTime") as TextBlock; txtTasksDueTime.Opacity = 1; args.RegisterUpdateCallback(ShowTasksReminder); }
private void MainList_OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var tile = GetTileImage(args); if (tile != null) { tile.Opacity = 0; tile.LoadingSuspended = true; args.RegisterUpdateCallback(Phase1Callback); } }
private void Phase1Callback(ListViewBase sender, ContainerContentChangingEventArgs args) { var templateRoot = args.ItemContainer.ContentTemplateRoot as PostView; if (templateRoot != null) { templateRoot.RenderPhase = 1; args.RegisterUpdateCallback(Phase2Callback); } }
/// <summary> /// Deals with populating apps which belongs to a particular category. /// </summary> /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param> /// <param name="args">ContainerContentChangingEventArgs args is a parameter called e that contains the event data, see the ContainerContentChangingEventArgs MSDN page for more information.</param> private void GridApps_ContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { args.Handled = true; if (args.Phase != 0) { throw new Exception("Not in phase 0."); } Apps app = (Apps)args.Item; StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot; TextBlock appName = (TextBlock)templateRoot.FindName("appName"); TextBlock appAuthor = (TextBlock)templateRoot.FindName("appAuthor"); Image appIcon = (Image)templateRoot.FindName("appIcon"); appName.Text = app.Name; appAuthor.Text = app.Author; appIcon.Source = new BitmapImage(new Uri("ms-appx:///Assets/notavailable.png")); args.RegisterUpdateCallback(ShowImage); }
private void TasksMain_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { return; //args.Handled = true; if (args.Phase != 0) { throw new Exception("not in phrase 0"); } Border borderTasksRoot = args.ItemContainer.ContentTemplateRoot as Border; Rectangle rectTasksCheckBox = borderTasksRoot.FindName("rectTasksCheckBox") as Rectangle; TextBlock txtTasksTitle = borderTasksRoot.FindName("txtTasksTitle") as TextBlock; TextBlock txtTasksDueTime = borderTasksRoot.FindName("txtTasksDueTime") as TextBlock; Rectangle rectTasksReminder = borderTasksRoot.FindName("rectTasksReminder") as Rectangle; Rectangle rectTasksRepeat = borderTasksRoot.FindName("rectTasksRepeat") as Rectangle; Rectangle rectTasksNote = borderTasksRoot.FindName("rectTasksNote") as Rectangle; txtTasksTitle.Opacity = 1; rectTasksCheckBox.Opacity = 0; txtTasksDueTime.Opacity = 0; rectTasksReminder.Opacity = 0; rectTasksRepeat.Opacity = 0; rectTasksNote.Opacity = 0; args.RegisterUpdateCallback(ShowTasksCheckBox); }
private void ContentListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var iv = args.ItemContainer.ContentTemplateRoot as IllustrationView; if (args.InRecycleQueue) { return; iv.ClearContent(); //var imageContent = iv.FindName("ImageContent") as Image; //var textContent = iv.FindName("TextContent") as TextBlock; //var progressIndicator = iv.FindName("ProgressBar") as ProgressBar; //var commentIndicator = iv.FindName("CommentIndicator") as Rectangle; //progressIndicator.Value = 0; //if (imageContent.Source != null) //{ // var bitmap = imageContent.Source as BitmapImage; // bitmap.DownloadProgress -= Image_DownloadProgress; //} //imageContent.DataContext = null; //imageContent.ClearValue(Image.SourceProperty); //imageContent.Visibility = Windows.UI.Xaml.Visibility.Collapsed; //imageContent.Height = 0; //textContent.ClearValue(TextBlock.TextProperty); iv.Height = double.NaN; args.ItemContainer.InvalidateMeasure(); args.Handled = true; return; } if (args.Phase == 0) { var line = (LineViewModel)args.Item; if (!Double.IsNaN(sender.ActualWidth) && sender.ActualWidth > 0) iv.MaxWidth = sender.ActualWidth; iv.ResetPhase0(line); //var imageContent = iv.FindName("ImageContent") as Image; //var textContent = iv.FindName("TextContent") as TextBlock; //var commentIndicator = iv.FindName("CommentIndicator") as Rectangle; //var progressIndicator = iv.FindName("ProgressBar") as ProgressBar; //var imagePlaceHolder = iv.FindName("ImagePlaceHolder") as Windows.UI.Xaml.Shapes.Path; //iv.Height = double.NaN; //imageContent.Opacity = 0; //imageContent.Height = double.NaN; //commentIndicator.Opacity = 0; //progressIndicator.Opacity = 0; //textContent.Opacity = 1; //if (imageContent.Source != null) //{ // var bitmap = imageContent.Source as BitmapImage; // bitmap.DownloadProgress -= Image_DownloadProgress; // imageContent.ClearValue(Image.SourceProperty); //} //if (line.IsImage) //{ // if (!AppGlobal.ShouldAutoLoadImage) // textContent.Text = ImageTapToLoadPlaceholder; // else // textContent.Text = ImageLoadingTextPlaceholder; // double aspect = (double)line.ImageHeight / (double)line.ImageWidth; // double ih = iv.Width * aspect; // if (ih <= 1.0) // ih = 440; // imageContent.Height = ih; // imagePlaceHolder.Height = ih; // progressIndicator.Visibility = Visibility.Visible; // imageContent.Visibility = Windows.UI.Xaml.Visibility.Visible; // imagePlaceHolder.Visibility = Windows.UI.Xaml.Visibility.Visible; // textContent.TextAlignment = TextAlignment.Center; //} //else //{ // textContent.Text = " " + line.Content; // //textContent.Height = double.NaN; // textContent.TextAlignment = TextAlignment.Left; // imagePlaceHolder.Visibility = Windows.UI.Xaml.Visibility.Collapsed; // imageContent.Visibility = Windows.UI.Xaml.Visibility.Collapsed; // imageContent.DataContext = null; //} args.RegisterUpdateCallback(ContentListView_ContainerContentChanging); //} else if (args.Phase == 1) //{ // //var textContent = iv.FindName("TextContent") as TextBlock; // //textContent.Opacity = 1; // //args.RegisterUpdateCallback(ContentListView_ContainerContentChanging); } else if (args.Phase == 1) // Show comment indicator rectangle / progress bar { var line = (LineViewModel)args.Item; var commentIndicator = iv.FindName("CommentIndicator") as Rectangle; if (line.HasComments) { commentIndicator.Opacity = 1; args.RegisterUpdateCallback(3, ContentListView_ContainerContentChanging); } if (line.IsImage) { var progressIndicator = iv.FindName("ProgressBar") as ProgressBar; progressIndicator.Value = 0; progressIndicator.Opacity = 1; if (AppGlobal.ShouldAutoLoadImage) args.RegisterUpdateCallback(2, ContentListView_ContainerContentChanging); } } else if (args.Phase == 2) { var line = (LineViewModel)args.Item; iv.LoadIllustrationLine(line); //LoadItemIllustation(iv, line); } //} //else if (args.Phase == 3) //{ // var line = (LineViewModel)args.Item; // line.LoadCommentsAsync(); //} args.Handled = true; }
private void commentsList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.InRecycleQueue) { } else if (args.ItemContainer.ContentTemplateRoot == null) { args.RegisterUpdateCallback(commentsList_ContainerContentChanging); } else { if (args.Item is LoadFullCommentsViewModel) { var contentControl = args.ItemContainer.ContentTemplateRoot as ContentControl; contentControl.ContentTemplate = Resources["LoadFullyTemplate"] as DataTemplate; } else if (args.Item is MoreViewModel) { var more = new MoreCommentsView { DataContext = args.Item }; more.SetBinding(UIElement.VisibilityProperty, new Binding { Path = new PropertyPath("IsVisible"), Converter = booleanVisiblityConverter }); var contentControl = args.ItemContainer.ContentTemplateRoot as ContentControl; contentControl.ContentTemplate = null; contentControl.Content = more; } else if (args.Item is CommentViewModel) { CommentView comment; if (args.ItemContainer.ContentTemplateRoot is ContentControl && !(((ContentControl)args.ItemContainer.ContentTemplateRoot).Content is CommentView)) { comment = new CommentView { DataContext = args.Item }; comment.SetBinding(UIElement.VisibilityProperty, new Binding { Path = new PropertyPath("IsVisible"), Converter = booleanVisiblityConverter }); var contentControl = args.ItemContainer.ContentTemplateRoot as ContentControl; contentControl.ContentTemplate = null; contentControl.Content = comment; } else { var contentControl = args.ItemContainer.ContentTemplateRoot as ContentControl; comment = contentControl.Content as CommentView; if (comment.DataContext != args.Item) { comment.DataContext = args.Item; comment.LoadPhase = 0; comment.LoadCancelSource.Cancel(); comment.LoadCancelSource = new System.Threading.CancellationTokenSource(); } } bool reregister = false; switch (comment.LoadPhase) { case 0: reregister = comment.Phase0Load(sender, args); break; case 1: reregister = comment.Phase1Load(sender, args); break; case 2: comment.Phase2Load(sender, args); break; } if (reregister) args.RegisterUpdateCallback(commentsList_ContainerContentChanging); } else { throw new NotImplementedException(); } } }
private void ListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { StackPanel root = (StackPanel)args.ItemContainer.ContentTemplateRoot; args.RegisterUpdateCallback(showOtionData); }
private void ShowText2(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.Phase == 2) { apiMealaroni.BizItem dd = (apiMealaroni.BizItem)args.Item; ListView templateRoot = (ListView)args.ItemContainer.ContentTemplateRoot; TextBlock ss2 = (TextBlock)templateRoot.FindName("templateTitle2"); ss2.Text = dd.address; ss2.Opacity = 1; args.RegisterUpdateCallback(ShowText3); } }
private void Item_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot; args.RegisterUpdateCallback(ShowItemDetails); }
private void ShowTasksRepeat(ListViewBase sender, ContainerContentChangingEventArgs args) { args.Handled = true; if (args.Phase != 4) { throw new Exception("not in phrase 0"); } Border borderTasksRoot = args.ItemContainer.ContentTemplateRoot as Border; Rectangle rectTasksRepeat = borderTasksRoot.FindName("rectTasksRepeat") as Rectangle; rectTasksRepeat.Opacity = 1; args.RegisterUpdateCallback(ShowTasksRestInfo); }
private void ShowText(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.Phase == 1) { apiMealaroni.BizItem dd = (apiMealaroni.BizItem)args.Item; ListView templateRoot = (ListView)args.ItemContainer.ContentTemplateRoot; TextBlock ss1 = (TextBlock)templateRoot.FindName("templateTitle1"); ss1.Text = dd.name.ToUpper(); ss1.Opacity = 1; args.RegisterUpdateCallback(ShowText2); } }
// Show the items rarity. private void ShowItemRarityName( ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.Phase != 2) { throw new Exception("Not in phase 2."); } // Next, show the items' subtitles. Keep everything else invisible. CraftPlanDetailView myItem = (CraftPlanDetailView)args.Item; SelectorItem itemContainer = (SelectorItem)args.ItemContainer; StackPanel templateRoot = (StackPanel)itemContainer.ContentTemplateRoot; TextBlock subtitleTextBlock = (TextBlock)templateRoot.FindName("itemRarityNameBlock"); subtitleTextBlock.Text = myItem.ItemRarityName; subtitleTextBlock.Opacity = 1; // Show the items type name in the next phase. args.RegisterUpdateCallback(ShowItemTypeName); }
private void init_picker(ListViewBase sender, ContainerContentChangingEventArgs args) { ComboBox comb_countries = (ComboBox)((ListView)sender).FindName("comb_countries"); args.RegisterUpdateCallback(init_picker1); }
private void ListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { ListView templateRoot = (ListView)args.ItemContainer.ContentTemplateRoot; TextBlock ss1 = (TextBlock)templateRoot.FindName("templateTitle1"); TextBlock ss2 = (TextBlock)templateRoot.FindName("templateTitle2"); TextBlock ss3 = (TextBlock)templateRoot.FindName("templateTitle3"); ss1.Opacity = ss2.Opacity = ss3.Opacity = 0; args.RegisterUpdateCallback(ShowText); }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs e) { UIElement contentTemplateRoot = e.ItemContainer.ContentTemplateRoot; ElementCacheRecord elementCacheRecord; if (this.elementCache.TryGetValue(contentTemplateRoot, out elementCacheRecord)) { if (!e.InRecycleQueue) { foreach (List<PhasedElementRecord> phaseRecord in elementCacheRecord.ElementsByPhase) { foreach (PhasedElementRecord phasedElementRecord in phaseRecord) { phasedElementRecord.FreezeAndHide(); } } if (elementCacheRecord.Phases.Count > 0) { e.RegisterUpdateCallback((uint)elementCacheRecord.Phases[0], this.OnContainerContentChangingCallback); } // set the DataContext manually since we inhibit default operation by setting e.Handled=true ((FrameworkElement)contentTemplateRoot).DataContext = e.Item; } else { // clear the DataContext manually since we inhibit default operation by setting e.Handled=true contentTemplateRoot.ClearValue(FrameworkElement.DataContextProperty); foreach (List<PhasedElementRecord> phaseRecord in elementCacheRecord.ElementsByPhase) { foreach (PhasedElementRecord phasedElementRecord in phaseRecord) { phasedElementRecord.ThawAndShow(); } } } e.Handled = true; } }