本文整理汇总了C#中ContainerContentChangingEventArgs.RegisterUpdateCallback方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerContentChangingEventArgs.RegisterUpdateCallback方法的具体用法?C# ContainerContentChangingEventArgs.RegisterUpdateCallback怎么用?C# ContainerContentChangingEventArgs.RegisterUpdateCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerContentChangingEventArgs
的用法示例。
在下文中一共展示了ContainerContentChangingEventArgs.RegisterUpdateCallback方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemGridView_ContainerContentChanging
/// <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;
}
示例2: Items_ContainerContentChanging
/// <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;
}
示例3: PhaseLoad
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
{
}
}
示例4: ListViewContainerContentChanging
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);
}
}
示例5: OnContainerContentChanging
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;
}
示例6: myCraftPlanList_ContainerContentChanging
// 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);
}
示例7: commentsList_ContainerContentChanging
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();
}
}
}
示例8: Phase1Callback
private void Phase1Callback(ListViewBase sender, ContainerContentChangingEventArgs args)
{
var templateRoot = args.ItemContainer.ContentTemplateRoot as PostView;
if (templateRoot != null)
{
templateRoot.RenderPhase = 1;
args.RegisterUpdateCallback(Phase2Callback);
}
}
示例9: GridScreenshots_ContainerContentChanging
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);
}
示例10: ShowText2
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);
}
}
示例11: OnContainerContentChangingCallback
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);
}
}
}
示例12: ShowTasksDueTime
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);
}
示例13: TasksMain_ContainerContentChanging
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);
}
示例14: ListView_ContainerContentChanging
private void ListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
StackPanel root = (StackPanel)args.ItemContainer.ContentTemplateRoot;
args.RegisterUpdateCallback(showOtionData);
}
示例15: Item_ContainerContentChanging
private void Item_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot;
args.RegisterUpdateCallback(ShowItemDetails);
}