private void RefreshSize() { Height = uiHeight + 2 * Distance; LeftButton.Height = Height; RightButton.Height = Height; // selectionFrame.Height = Height; // selectionFrame.Width = uiWidth + 2 * Distance; // selectionFrame.AnimateBy = uiWidth + 2 * Distance; Width = (animatedUIsCount - 2) * (uiWidth + (2 * Distance)) + LeftButton.Width + RightButton.Width; LayoutRoot.Width = Width; dataCanvas.Width = Width - LeftButton.Width - RightButton.Width; clippingRect.Width = Width - LeftButton.Width - RightButton.Width; clippingGeometry.Rect = clippingRect; for (int i = 0; i < animationsList.Count; i++) { AnimationUI current = animationsList[i]; current.Height = this.UIHeight; current.Width = this.UIWidth; current.AnimateBy = uiWidth + 2 * Distance; current.SetValue(Canvas.TopProperty, Distance); current.SetValue(Canvas.LeftProperty, Distance + (i - 1) * (this.UIWidth + 2 * Distance)); } dataCanvas.SetValue(Canvas.LeftProperty, RightButton.Width); }
private void AddVisible(UIElement newUI) { AnimationUI newImage = new AnimationUI(); dataCanvas.Children.Add(newImage); newImage.ContentSource = newUI; newImage.Height = this.UIHeight; newImage.Width = this.UIWidth; newImage.SetValue(Canvas.TopProperty, Distance); newImage.SetValue(Canvas.LeftProperty, Distance + (this.animationsList.Count - 1) * (this.UIWidth + 2 * Distance)); newImage.AnimateBy = uiWidth + 2 * Distance; newImage.AnimationDuration = new Duration(TimeSpan.FromMilliseconds(scrollingTime)); newImage.Click += new EventHandler <MouseEventArgs>(UIClicked); newImage.AnimationCompleted += new EventHandler <AnimationUIEventArgs>(UIAnimationCompleted); animationsList.Add(newImage); readyAnimationsCount = animationsList.Count; }