private void RefreshSize() { // Height = uiHeight + 2 * Distance; Width = uiWidth;// +2 * Distance; // LeftButton.Height = Height; // RightButton.Height = Height; LeftButton.Width = Width; RightButton.Width = Width; //Width = (animatedUIsCount - 2) * (uiWidth + (2 * Distance)) + LeftButton.Width + RightButton.Width; Height = (animatedUIsCount - 2) * (uiHeight + (2 * Distance)) + LeftButton.Height + RightButton.Height; /*LayoutRoot.Width = Width; * dataCanvas.Width = Width - LeftButton.Width - RightButton.Width; * clippingRect.Width = Width - LeftButton.Width - RightButton.Width;*/ LayoutRoot.Height = Height; dataCanvas.Height = Height - LeftButton.Height - RightButton.Height; clippingRect.Height = Height - LeftButton.Height - RightButton.Height; 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.AnimateBy = uiHeight + 2 * Distance; // current.SetValue(Canvas.TopProperty, Distance); // current.SetValue(Canvas.LeftProperty, Distance + (i - 1) * (this.UIWidth + 2 * Distance)); current.SetValue(Canvas.LeftProperty, Distance); current.SetValue(Canvas.TopProperty, Distance + (i - 1) * (this.UIHeight + 2 * Distance)); } //dataCanvas.SetValue(Canvas.LeftProperty, RightButton.Width); dataCanvas.SetValue(Canvas.TopProperty, RightButton.Height); }
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.SetValue(Canvas.LeftProperty, Distance); newImage.SetValue(Canvas.TopProperty, Distance + (this.animationsList.Count - 1) * (this.UIHeight + 2 * Distance)); //newImage.AnimateBy = uiWidth + 2 * Distance; newImage.AnimateBy = uiHeight + 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; }