本文整理汇总了C#中Windows.UI.Xaml.Controls.ListViewBase类的典型用法代码示例。如果您正苦于以下问题:C# ListViewBase类的具体用法?C# ListViewBase怎么用?C# ListViewBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListViewBase类属于Windows.UI.Xaml.Controls命名空间,在下文中一共展示了ListViewBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnContainerContentChanging
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
if (args.InRecycleQueue)
{
ListViewItem lvi = (args.ItemContainer as ListViewItem);
if (lvi != null)
{
UIElement element = VisualTreeHelper.GetChild(lvi, 0) as UIElement;
if (element != null)
{
element.PointerPressed -= OnPointerPressed;
element.PointerReleased -= OnPointerReleased;
element.PointerCaptureLost -= OnPointerCaptureLost;
element.PointerExited -= OnPointerExited;
}
}
}
else if (args.Phase == 0)
{
ListViewItem lvi = (args.ItemContainer as ListViewItem);
if (null != lvi)
{
UIElement element = VisualTreeHelper.GetChild(lvi, 0) as UIElement;
if (null != element)
{
element.PointerPressed += OnPointerPressed;
element.PointerReleased += OnPointerReleased;
element.PointerCaptureLost += OnPointerCaptureLost;
element.PointerExited += OnPointerExited;
}
}
}
}
示例2: ScrollItem
public static void ScrollItem(ListViewBase control, int indexDelta)
{
if (control == null || control.Items == null)
return;
var scrollViewer = VisualTreeUtilities.GetVisualChild<ScrollViewer>(control);
var p = new Point(Window.Current.Bounds.Width/2, 10);
var transform = control.TransformToVisual(Window.Current.Content);
var checkPoint = transform.TransformPoint(p);
var q = from lvi in VisualTreeHelper.FindElementsInHostCoordinates(checkPoint, scrollViewer).OfType<ListViewItem>()
where lvi.Content != null
select lvi.Content;
var item = q.FirstOrDefault();
if (item == null)
return;
var index = control.Items.IndexOf(item);
var nextItemIndex = index + indexDelta;
if (index != -1 && nextItemIndex >= 0 && nextItemIndex < control.Items.Count)
{
var nextItem = control.Items[nextItemIndex];
control.ScrollIntoView(nextItem, ScrollIntoViewAlignment.Leading);
}
}
示例3: lvListSelectionChanged_Changed
//SignoffStatus Grid Select Event : Load WorkFlowBar
private async void lvListSelectionChanged_Changed(object sender, ListViewBase e)
{
try
{
ucWorkFlowBanner.GridClear();
IWPWorkflowStatusdto = (IWPWorkflowStatusBypersonnelid_type_term)e.SelectedItem;
List<WorkflowDetailByIWPID> workflowbannerdto = new List<WorkflowDetailByIWPID>();
await _Workflow.GetWorkflowDetailByProcessID(IWPWorkflowStatusdto.ProcessId);
workflowbannerdto = _Workflow.GetWorkflowDetail();
ucWorkFlowBanner.LoadWorkFlow(workflowbannerdto);
Lib.WorkFlowDataSource.PackageTypeCode = IWPWorkflowStatusdto.PackageTypeCode;
Lib.WorkFlowDataSource.selectedTypeName = IWPWorkflowStatusdto.PackageTypeName;
Lib.WorkFlowDataSource.selectedDocumentID = IWPWorkflowStatusdto.TargetId;
Lib.WorkFlowDataSource.selectedIwpID = IWPWorkflowStatusdto.IwpId;
if (btnsentstatus != "")
Lib.WorkFlowDataSource.sentyn = btnsentstatus;
}
catch (Exception ex)
{
}
}
示例4: Phase0Load
internal bool Phase0Load(ListViewBase sender, ContainerContentChangingEventArgs args)
{
if (!args.InRecycleQueue)
{
if (((CommentViewModel)args.Item).IsEditing)
{
var editContent = (Resources["editingTemplate"] as DataTemplate).LoadContent() as FrameworkElement;
editContent.DataContext = ((CommentViewModel)DataContext).ReplyViewModel;
contentControl.Content = editContent;
contentControl.MinHeight = 0;
return false;
}
else
{
contentControl.ContentTemplate = null;
contentControl.Content = null;
var body = ((CommentViewModel)args.Item).Body ?? "";
contentControl.MinHeight = Math.Max(25, body.Length / 2);
args.Handled = true;
LoadPhase = 1;
return true;
}
}
return false;
}
示例5: ItemListView_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) Title and placeholder for Image (visualized synchronously - Phase 0)
/// 2) Subtilte (visualized asynchronously - Phase 1)
/// 3) Image (visualized asynchronously - Phase 2)
///
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void ItemListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
Scenario2ItemViewer iv = args.ItemContainer.ContentTemplateRoot as Scenario2ItemViewer;
if (args.InRecycleQueue == true)
{
iv.ClearData();
}
else if (args.Phase == 0)
{
iv.ShowTitle(args.Item as Item);
// Register for async callback to visualize Title asynchronously
args.RegisterUpdateCallback(ContainerContentChangingDelegate);
}
else if (args.Phase == 1)
{
iv.ShowSubtitle();
args.RegisterUpdateCallback(ContainerContentChangingDelegate);
}
else if (args.Phase == 2)
{
iv.ShowImage();
}
// For imporved performance, set Handled to true since app is visualizing the data item
args.Handled = true;
}
示例6: ItemGridView_ContainerContentChanging
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;
}
示例7: 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;
}
示例8: ListView_ContainerContentChanging
private void ListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
CompositionImage image = args.ItemContainer.ContentTemplateRoot.GetFirstDescendantOfType<CompositionImage>();
Thumbnail thumbnail = args.Item as Thumbnail;
// Update the image URI
image.Source = new Uri(thumbnail.ImageUrl);
}
示例9: OnContainerContentChanging
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
var visual = ElementCompositionPreview.GetElementVisual(args.ItemContainer);
visual.ImplicitAnimations = args.InRecycleQueue
? null
: animations;
}
示例10: messageList_ContainerContentChanging
private void messageList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
if (args.ItemContainer.ContentTemplateRoot is MessageControl)
{
var message = args.ItemContainer.ContentTemplateRoot as MessageControl;
message.DataContext = args.Item;
message.PhaseLoad(sender, args);
}
}
示例11: ClearPreviousEvents
private static void ClearPreviousEvents(ListViewBase listView)
{
ItemClickEventHandler eventHandler;
if (_eventHandlers.TryGetValue(listView, out eventHandler))
{
listView.ItemClick -= eventHandler;
_eventHandlers.Remove(listView);
}
}
示例12: TrySelectItem
private bool TrySelectItem(ListViewBase listView, Func<object, bool> predicator)
{
var item = listView.Items.FirstOrDefault(predicator);
if (item != null)
{
listView.SelectedItem = item;
return true;
}
return false;
}
示例13: HandleItemClick
private static void HandleItemClick(ListViewBase listView, object item)
{
var command = GetCommand(listView);
if (command == null || !command.CanExecute(item))
{
return;
}
command.Execute(item);
}
示例14: NavMenuItemContainerContentChanging
/// <summary>
/// Enable accessibility on each nav menu item by setting the AutomationProperties.Name on each container
/// using the associated Label of each item.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void NavMenuItemContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
if (!args.InRecycleQueue && args.Item != null && args.Item is NavMenuItem)
{
args.ItemContainer.SetValue(AutomationProperties.NameProperty, ((NavMenuItem)args.Item).Label);
}
else
{
args.ItemContainer.ClearValue(AutomationProperties.NameProperty);
}
}
示例15: OnContainerContentChanging
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
{
if (args.InRecycleQueue)
{
if (_index > _associatedObject.Items.Count - 1)
{
_index = _associatedObject.Items.Count - 1;
}
_associatedObject.SelectedIndex = _index;
}
}
开发者ID:madeinouweland,项目名称:windows-10-select-after-remove-item-behavior,代码行数:11,代码来源:SelectAfterRemoveBehavior.cs