本文整理汇总了C#中ItemsChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ItemsChangedEventArgs类的具体用法?C# ItemsChangedEventArgs怎么用?C# ItemsChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemsChangedEventArgs类属于命名空间,在下文中一共展示了ItemsChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnItemsChanged
protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args) {
ItemsControl itemsOwner;
switch (args.Action) {
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Replace:
case NotifyCollectionChangedAction.Move:
// THE HACK
RemoveChildRange(args.Position, args.ItemCount, args.ItemUICount);
return;
case NotifyCollectionChangedAction.Reset:
itemsOwner = ItemsControl.GetItemsOwner(this);
if (itemsOwner == null)
return;
if (PreviousItemCount != itemsOwner.Items.Count) {
if (Orientation != Orientation.Horizontal) {
SetHorizontalOffset(0.0);
break;
}
SetVerticalOffset(0.0);
}
break;
default:
return;
}
var itemCount = itemsOwner.Items.Count;
PreviousItemCount = itemCount;
}
示例2: ItemContainerGeneratorOnItemsChanged
private void ItemContainerGeneratorOnItemsChanged(object sender, ItemsChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Reset)
{
MixListScrollViewer.ScrollToTop();
}
}
示例3: ItemContainerGenerator_ItemsChanged
void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
Position item = lstPositions.Items.Last() as Position;
location = new GeoCoordinate(item.Latitude, item.Longitude);
mapPositions.Center = location;
layer = new MapLayer();
grid = new Grid();
grid.DataContext = item;
grid.Hold += grid_Hold;
textBlock = new TextBlock();
textBlock.Text = item.Counter.ToString();
textBlock.VerticalAlignment = VerticalAlignment.Bottom;
textBlock.HorizontalAlignment = HorizontalAlignment.Center;
brush = new ImageBrush();
brush.ImageSource = image;
ellipse = new Ellipse();
ellipse.Height = 100;
ellipse.Width = 100;
ellipse.Fill = brush;
grid.Children.Add(ellipse);
grid.Children.Add(textBlock);
overlay = new MapOverlay();
overlay.Content = grid;
overlay.GeoCoordinate = location;
layer.Add(overlay);
mapPositions.Layers.Add(layer);
}
}
示例4: OnItemsChangedItemContainerGenerator
void OnItemsChangedItemContainerGenerator(object sender, ItemsChangedEventArgs e)
{
ItemsControl ic = ItemsControl.ItemsControlFromItemContainer(item);
if (null == ic)
return;
item.SetValue(IsLastOneProperty, ic.ItemContainerGenerator.IndexFromContainer(item) == ic.Items.Count - 1);
}
示例5: ModifyModelActionOnItemsChanged
private void ModifyModelActionOnItemsChanged(object sender, ItemsChangedEventArgs e){
foreach (var itemChangesType in e.ChangedItemsInfo.Where(pair => pair.Value==ChoiceActionItemChangesType.Add)){
var choiceActionItem = itemChangesType.Key as ChoiceActionItem;
if (choiceActionItem != null && choiceActionItem.Id==ModifyModelActionChoiceItemsUpdater.ChangeViewModel) {
choiceActionItem.Active.BeginUpdate();
choiceActionItem.Active["ModelNotConfigured"] = ((IModelViewConfigurationView)View.Model).ConfigurationView != null;
choiceActionItem.Active.EndUpdate();
}
}
}
示例6: OnItemsChangedInternal
void OnItemsChangedInternal (object sender, ItemsChangedEventArgs args)
{
InvalidateMeasure ();
if (args.Action == NotifyCollectionChangedAction.Reset) {
Children.Clear ();
ItemContainerGenerator.RemoveAll ();
OnClearChildren ();
}
OnItemsChanged (sender, args);
}
示例7: OnItemsChanged
void OnItemsChanged(object sender, ItemsChangedEventArgs itemsChangedEventArgs) {
var changedItemsInfo = itemsChangedEventArgs.ChangedItemsInfo;
foreach (var actionItemChangesType in changedItemsInfo) {
if (actionItemChangesType.Key is ChoiceActionItem && actionItemChangesType.Value == ChoiceActionItemChangesType.Add) {
var choiceActionItem = ((ChoiceActionItem)actionItemChangesType.Key);
var transition = choiceActionItem.Data as ITransition;
if (transition != null)
choiceActionItem.Active["Permission"] = !IsGranted(transition.TargetState);
}
}
}
示例8: OnItemsChanged
protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args)
{
switch (args.Action)
{
case NotifyCollectionChangedAction.Move:
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Replace:
RemoveInternalChildRange(args.Position.Index, args.ItemUICount);
break;
}
base.OnItemsChanged(sender, args);
}
示例9: AddNodeActionOnItemsChanged
void AddNodeActionOnItemsChanged(object sender, ItemsChangedEventArgs itemsChangedEventArgs) {
var singleChoiceAction = (sender) as SingleChoiceAction;
if (singleChoiceAction != null && (singleChoiceAction.Id == "Add" && itemsChangedEventArgs.ChangedItemsInfo.Values.Contains(ChoiceActionItemChangesType.ItemsAdd))) {
if (CurrentModelNode.ModelNode.GetType().Name == "ModelLogicRules") {
var modelTreeListNode = CurrentModelNode.Parent;
for (int i = singleChoiceAction.Items.Count - 1; i > -1; i--) {
var value = modelTreeListNode.ModelNode.Id.Replace("Conditional", "");
if (!singleChoiceAction.Items[i].Id.StartsWith(value))
singleChoiceAction.Items.RemoveAt(i);
}
}
}
}
示例10: AddNodeActionOnItemsChanged
void AddNodeActionOnItemsChanged(object sender, ItemsChangedEventArgs itemsChangedEventArgs) {
var singleChoiceAction = (sender) as SingleChoiceAction;
if ((singleChoiceAction != null && singleChoiceAction.Id == "Add") && (itemsChangedEventArgs.ChangedItemsInfo.Values.Contains(ChoiceActionItemChangesType.ItemsAdd | ChoiceActionItemChangesType.ItemsRemove))) {
string name = CurrentModelNode.ModelNode.GetType().Name;
switch (name) {
case "ModelLogicRules":
FilterModelLogicRules(singleChoiceAction);
break;
case "ModelBOModelClassMembers":
EnableBOModelClassMembersAddMenu();
break;
}
}
}
示例11: ItemsChanged
/// <summary>
/// Event handler for the items changed event
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A <see cref="ItemsChangedEventArgs"/> that contains the event data.</param>
private static void ItemsChanged(object sender, ItemsChangedEventArgs e)
{
ItemsControl control;
if (itemsControls.TryGetValue(sender, out control))
{
if (ShouldShowWatermark(control))
{
ShowWatermark(control);
}
else
{
RemoveWatermark(control);
}
}
}
示例12: ItemContainerGeneratorOnItemsChanged
private void ItemContainerGeneratorOnItemsChanged(object sender, ItemsChangedEventArgs itemsChangedEventArgs)
{
//throw new NotImplementedException();
}
示例13: singleChoiceAction_ItemsChanged
private void singleChoiceAction_ItemsChanged(object sender, ItemsChangedEventArgs e)
{
if ((
from a in e.ChangedItemsInfo.Values
where a == ChoiceActionItemChangesType.Items
select a).Count<ChoiceActionItemChangesType>() > 0)
{
this.ItemChanged(this, ChoiceActionItemChangesType.Items);
}
}
示例14: OnItemsMove
private void OnItemsMove(ItemsChangedEventArgs args)
{
RemoveChildRange(args.OldPosition, args.ItemCount, args.ItemUICount);
}
示例15: OnItemsChanged
protected override void OnItemsChanged (object sender, ItemsChangedEventArgs args)
{
base.OnItemsChanged (sender, args);
IItemContainerGenerator generator = ItemContainerGenerator;
ItemsControl owner = ItemsControl.GetItemsOwner (this);
int index, offset, viewable, delta;
switch (args.Action) {
case NotifyCollectionChangedAction.Add:
// The following logic is meant to keep the current viewable items in view
// after adjusting for added items.
index = generator.IndexFromGeneratorPosition (args.Position);
if (Orientation == Orientation.Horizontal)
offset = (int) HorizontalOffset;
else
offset = (int) VerticalOffset;
if (index <= offset) {
// items have been added earlier in the list than what is viewable
offset += args.ItemCount;
}
if (Orientation == Orientation.Horizontal)
SetHorizontalOffset (offset);
else
SetVerticalOffset (offset);
break;
case NotifyCollectionChangedAction.Remove:
// The following logic is meant to keep the current viewable items in view
// after adjusting for removed items.
index = generator.IndexFromGeneratorPosition (args.Position);
if (Orientation == Orientation.Horizontal) {
offset = (int) HorizontalOffset;
viewable = (int) ViewportWidth;
} else {
viewable = (int) ViewportHeight;
offset = (int) VerticalOffset;
}
if (index < offset) {
// items earlier in the list than what is viewable have been removed
offset = Math.Max (offset - args.ItemCount, 0);
}
// adjust for items removed in the current view and/or beyond the current view
offset = Math.Min (offset, owner.Items.Count - viewable);
offset = Math.Max (offset, 0);
if (Orientation == Orientation.Horizontal)
SetHorizontalOffset (offset);
else
SetVerticalOffset (offset);
RemoveInternalChildRange (args.Position.Index, args.ItemUICount);
break;
case NotifyCollectionChangedAction.Replace:
RemoveInternalChildRange (args.Position.Index, args.ItemUICount);
break;
case NotifyCollectionChangedAction.Reset:
// DO NOTHING
break;
}
InvalidateMeasure ();
if (ScrollOwner != null)
ScrollOwner.InvalidateScrollInfo ();
}