Inheritance: Windows.UI.Xaml.Controls.UserControl
Esempio n. 1
0
        private void gvMain_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
        {
            if (string.IsNullOrEmpty(ThumbnailFieldName))
            {
                return;
            }

            try
            {
                //var imgs = args.ItemContainer.ContentTemplateRoot.GetFirstDescendantOfType<CompositionImage>();
                //CompositionImage image = imgs.First();

                CompositionImage image     = args.ItemContainer.ContentTemplateRoot.GetFirstDescendantOfType <CompositionImage>();
                dynamic          thumbnail = args.Item as dynamic;
                //Uri uri = new Uri(thumbnail.SquareThumbnailUrl);
                var propertyInfo = thumbnail.GetType().GetProperty(ThumbnailFieldName);
                var value        = propertyInfo.GetValue(thumbnail, null);
                Uri uri          = new Uri(value);

                // Setup the brush for this image
                SetImageEffect(image);

                // Update the image URI
                image.Source = uri;
            }
            catch (Exception ex) { }
        }
Esempio n. 2
0
        //LightingTypes _selectedLight = LightingTypes.PointDiffuse;
        private void SetImageEffect(CompositionImage image)
        {
            if (_effectFactory == null)
            {
                return;
            }

            // Create the effect brush and bind the normal map
            CompositionEffectBrush brush = _effectFactory.CreateBrush();

            //ComboBoxItem item = LightingSelection.SelectedValue as ComboBoxItem;
            //switch ((LightingTypes)item.Tag)
            switch (SelectedLight)
            {
            case LightingTypes.SpotLightSpecular:
            case LightingTypes.PointSpecular:
            case LightingTypes.DistantDiffuse:
            case LightingTypes.DistantSpecular:
                brush.SetSourceParameter("NormalMap", _circleNormalsBrush);
                break;

            default:
                brush.SetSourceParameter("NormalMap", _flatNormalsBrush);
                break;
            }

            // Update the CompositionImage to use the custom effect brush
            image.Brush = brush;
        }
Esempio n. 3
0
 private void UpdateEffectBrush(BrushType brushType)
 {
     if (ccMain.Content != null && ccMain.Content is CompositionImage)
     {
         //foreach (ListViewItem item in gvMain.ItemsPanelRoot.Children)
         //{
         //  CompositionImage image = item.ContentTemplateRoot.GetFirstDescendantOfType<CompositionImage>();
         CompositionImage image = (CompositionImage)ccMain.Content;
         //var imgs = item.ContentTemplateRoot.GetDescendantsOfType<CompositionImage>();
         //CompositionImage image = imgs.Last();
         SetImageEffect(image, brushType);
         //}
     }
 }
Esempio n. 4
0
 private void UpdateEffectBrush()
 {
     if (gvMain.ItemsPanelRoot != null)
     {
         foreach (var item in gvMain.ItemsPanelRoot.Children)
         {
             if (item is ListViewItem)
             {
                 CompositionImage image = ((ListViewItem)item).ContentTemplateRoot.GetFirstDescendantOfType <CompositionImage>();
                 //var imgs = item.ContentTemplateRoot.GetDescendantsOfType<CompositionImage>();
                 //CompositionImage image = imgs.Last();
                 SetImageEffect(image);
             }
         }
     }
 }
Esempio n. 5
0
        //LightingTypes _selectedLight = LightingTypes.PointDiffuse;
        private void SetImageEffect(CompositionImage image)
        {
            if (_effectFactory == null) return;

            // Create the effect brush and bind the normal map
            CompositionEffectBrush brush = _effectFactory.CreateBrush();

            //ComboBoxItem item = LightingSelection.SelectedValue as ComboBoxItem;
            //switch ((LightingTypes)item.Tag)
            switch (SelectedLight)
            {
                case LightingTypes.SpotLightSpecular:
                case LightingTypes.PointSpecular:
                case LightingTypes.DistantDiffuse:
                case LightingTypes.DistantSpecular:
                    brush.SetSourceParameter("NormalMap", _circleNormalsBrush);
                    break;
                default:
                    brush.SetSourceParameter("NormalMap", _flatNormalsBrush);
                    break;
            }

            // Update the CompositionImage to use the custom effect brush
            image.Brush = brush;
        }