예제 #1
0
        private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RadCycleHubTile tile = d as RadCycleHubTile;

            IList       sourceAsList        = e.NewValue as IList;
            IEnumerable sourceAsIEnumerable = e.NewValue as IEnumerable;
            INotifyCollectionChanged sourceAsCollectionChanged = e.NewValue as INotifyCollectionChanged;

            if (sourceAsList != null)
            {
                tile.sourceAsList = sourceAsList;
            }
            else
            {
                tile.sourceAsList = new List <object>();

                if (sourceAsIEnumerable != null)
                {
                    foreach (var item in sourceAsIEnumerable)
                    {
                        tile.sourceAsList.Add(item);
                    }
                }
            }
            tile.UpdateTimerState();
            tile.index = -1;

            tile.UnsubscribeFromColectionChanged();
            if (sourceAsCollectionChanged != null)
            {
                tile.collectionChangedEventHandler = new WeakEventHandler <NotifyCollectionChangedEventArgs>(sourceAsCollectionChanged, (IWeakEventListener)tile, KnownEvents.CollectionChanged);
            }
        }
예제 #2
0
        private static void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RadCycleHubTile tile = d as RadCycleHubTile;
            string          path;
            Orientation     orientation = (Orientation)e.NewValue;

            if (orientation == Orientation.Horizontal)
            {
                path = "(Canvas.Left)";
            }
            else
            {
                path = "(Canvas.Top)";
            }
            tile.globalContentAnimation.Stop();
            tile.localContentAnimation.Stop();
            Storyboard.SetTargetProperty(tile.moveUpGlobalAnimation, path);
            Storyboard.SetTargetProperty(tile.moveUpLocalAnimation, path);
        }