Exemple #1
0
        private void UnsubscribeFromItemsUpdating(GraphItemCollection collection)
        {
            if (collection == null)
            {
                return;
            }

            collection.CollectionChanged -= GraphItemsCollectionChanged;
            foreach (var item in collection)
            {
                item.Updated -= ItemUpdated;
            }
        }
Exemple #2
0
        private void SubscribeToItemsUpdating(GraphItemCollection collection)
        {
            if (collection == null)
            {
                return;
            }

            collection.CollectionChanged += GraphItemsCollectionChanged;
            foreach (var item in collection)
            {
                PrepareItem(item);
            }
        }
Exemple #3
0
        public GraphControlBase()
        {
            Items = new UIElementCollection(this, this);

            mInternalItems = new GraphControlItems();
            AddLogicalChild(mInternalItems);
            AddVisualChild(mInternalItems);

            GraphItems = new GraphItemCollection();
            SubscribeToItemsUpdating(GraphItems);
            mInternalItems.ItemsSource = GraphItems;

            DataContextChanged += (s, e) =>
            { mInternalItems.DataContext = e.NewValue; };
        }