private async void CreateImageBingUI()
        {
            ImageSource imageSource = await this.GetImageSource();

            if (imageSource != null)
            {
                //Image image = new Image() { Stretch = Stretch.UniformToFill };
                //image.Source = imageSource;
                //this.FirstContent = image;

                //image = new Image() { Stretch = Stretch.UniformToFill };
                //image.Source = imageSource;
                //this.SecondContent = image;

                ClipImage clipImage = new ClipImage()
                {
                    Width = this.Width, Height = this.Height
                };
                clipImage.Source  = imageSource;
                this.FirstContent = clipImage;

                clipImage = new ClipImage()
                {
                    Width = this.Width, Height = this.Height
                };
                clipImage.Source   = imageSource;
                this.SecondContent = clipImage;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the template parts and sets binding.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _notificationBlock = base.GetTemplateChild(NotificationBlock) as TextBlock;
            _messageBlock      = base.GetTemplateChild(MessageBlock) as TextBlock;
            _backTitleBlock    = base.GetTemplateChild(BackTitleBlock) as TextBlock;
            imageDefault       = base.GetTemplateChild(DefaultImage) as Image;
            imageOpposite      = base.GetTemplateChild(OppositeImage) as Image;
            //image = base.GetTemplateChild(Image) as Image;
            image = base.GetTemplateChild(Image) as ClipImage;

            if (image != null)
            {
                image.ImageOpened += image_ImageOpened;
            }

            //Do binding in code to avoid exposing unnecessary value converters.
            if (_notificationBlock != null)
            {
                Binding bindVisible = new Binding();
                bindVisible.Source             = this;
                bindVisible.Path               = new PropertyPath("DisplayNotification");
                bindVisible.Converter          = new VisibilityConverter();
                bindVisible.ConverterParameter = false;
                _notificationBlock.SetBinding(TextBlock.VisibilityProperty, bindVisible);
            }

            if (_messageBlock != null)
            {
                Binding bindCollapsed = new Binding();
                bindCollapsed.Source             = this;
                bindCollapsed.Path               = new PropertyPath("DisplayNotification");
                bindCollapsed.Converter          = new VisibilityConverter();
                bindCollapsed.ConverterParameter = true;
                _messageBlock.SetBinding(TextBlock.VisibilityProperty, bindCollapsed);
            }

            if (_backTitleBlock != null)
            {
                Binding bindTitle = new Binding();
                bindTitle.Source    = this;
                bindTitle.Path      = new PropertyPath("Title");
                bindTitle.Converter = new MultipleToSingleLineStringConverter();
                _backTitleBlock.SetBinding(TextBlock.TextProperty, bindTitle);
            }

            UpdateVisualState();
            this.SizeChanged += HubTile_SizeChanged;
        }
        private async void OnCurrentAnimationCompleted(object sender, object e)
        {
            this.firstContentContainer.LayoutUpdated += this.OnFirstContentLayoutUpdated;

            Canvas.SetTop(this.panel, 0);
            Canvas.SetTop(this.firstContentContainer, 0);

            //Image firstImage = this.FirstContent as Image;
            //Image secondImage = this.SecondContent as Image;
            ClipImage firstImage  = this.FirstContent as ClipImage;
            ClipImage secondImage = this.SecondContent as ClipImage;

            ImageSource tmp = secondImage.Source;

            secondImage.Source = null;
            firstImage.Source  = tmp;

            secondImage.Source = await this.GetImageSource();
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            //firstImage = this.GetTemplateChild("FirstHeader") as Image;
            //secondImage = this.GetTemplateChild("SecondHeader") as Image;
            firstImage      = this.GetTemplateChild("FirstHeader") as ClipImage;
            secondImage     = this.GetTemplateChild("SecondHeader") as ClipImage;
            firstTitleName  = this.GetTemplateChild("firstTitleName") as TextBlock;
            firstContent    = this.GetTemplateChild("firstContent") as TextBlock;
            secondTitleName = this.GetTemplateChild("secondTitleName") as TextBlock;
            secondContent   = this.GetTemplateChild("secondContent") as TextBlock;

            this.panel = this.GetTemplateChild("PART_Panel") as UIElement;
            if (this.panel == null)
            {
                throw new MissingTemplatePartException(typeof(UIElement), "PART_Panel");
            }

            this.firstContentContainer = this.GetTemplateChild("PART_FirstContent") as FrameworkElement;

            Storyboard.SetTarget(this.moveUpLocalAnimation, this.firstContentContainer);
            Storyboard.SetTarget(this.moveUpGlobalAnimation, this.panel);
        }