コード例 #1
0
        private static void ImageMapper(ImageHandler handler, IImage view)
        {
            if (view is not Image image)
            {
                return;
            }

            var selector = (string)image.GetValue(FontIcon.IconProperty);

            image.Source = new IconImageSource
            {
                Name  = selector,
                Color = (Color)image.GetValue(FontIcon.ColorProperty),
                Size  = (double)image.GetValue(FontIcon.SizeProperty)
            };
        }
コード例 #2
0
        private static void ImageMapper(ImageHandler handler, IImage view)
        {
            if (view is not Image image)
            {
                return;
            }

            var selector = (string)image.GetEnvironment(KnownPropertyNames.Icon, cascades: false);
            var color    = (Color)(image.GetEnvironment(KnownPropertyNames.Color, cascades: false) ?? Colors.Black);
            var size     = (double)(image.GetEnvironment(KnownPropertyNames.Size, cascades: false) ?? 12);

            image.SetEnvironment("Source",
                                 new IconImageSource
            {
                Name  = selector,
                Color = color,
                Size  = size
            },
                                 cascades: false);
        }