/// <summary> /// Cambia el tamaño de un control /// </summary> private void ExecuteResize(TimeLineModel timeLine, FrameworkElement control, ResizeActionModel action) { if (CheckMustAnimate(action)) { if (action.Width != null) { CreateDoubleAnimation(control, null, action.Width ?? 100, new PropertyPath(ComicPageView.PageWidthProperty), action); } if (action.Height != null) { CreateDoubleAnimation(control, null, action.Height ?? 100, new PropertyPath(ComicPageView.PageHeightProperty), action); } } else { if (action.Width != null) { ComicPageView.SetPageWidth(control, action.Width ?? 100); } if (action.Height != null) { ComicPageView.SetPageHeight(control, action.Height ?? 100); } } }
/// <summary> /// Añade un control /// </summary> private void AddControl(UIElement control, AbstractPageItemModel pageItem) { // Le asigna la clave al control (control as FrameworkElement).Tag = pageItem.Key; // Cambia la visibilidad y opacidad del control if (pageItem.Visible) { control.Opacity = 1; } else { control.Opacity = 0; } if (pageItem.Opacity != 0) { control.Opacity = pageItem.Opacity; } // Inicializa un grupo de transformaciones control.RenderTransform = new TransformGroup(); // Asigna las propiedades ComicPageView.SetPageTop(control, pageItem.Dimensions.TopDefault); ComicPageView.SetPageLeft(control, pageItem.Dimensions.LeftDefault); ComicPageView.SetPageWidth(control, pageItem.Dimensions.WidthDefault); ComicPageView.SetPageHeight(control, pageItem.Dimensions.HeightDefault); Grid.SetZIndex(control, pageItem.ZIndex); // Añade el control a la vista Children.Add(control); // Añade el adorno si es necesario if (ShowAdorners) { AdornerLayer.GetAdornerLayer(control)?.Add(new FourCornersAdorner(control)); } }