Exemplo n.º 1
0
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     if (PresentationResourceService.InstanceAvailable)
     {
         return(PresentationResourceService.GetBitmapSource(_key));
     }
     else
     {
         return(_key);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets an image source from a resource.
 /// </summary>
 /// <exception cref="ResourceNotFoundException">The resource with the specified name does not exist</exception>
 public static ImageSource GetImageSource(this IResourceService resourceService, string resourceName)
 {
     if (resourceService == null)
     {
         throw new ArgumentNullException("resourceService");
     }
     if (resourceName == null)
     {
         throw new ArgumentNullException("resourceName");
     }
     return(PresentationResourceService.GetBitmapSource(resourceName));
 }
Exemplo n.º 3
0
        public IndexToImageConverter(IEnumerable <string> imageResourceNames)
        {
            _imageList = new List <ImageSource>();

            foreach (var name in imageResourceNames)
            {
                if (PresentationResourceService.InstanceAvailable)
                {
                    _imageList.Add(PresentationResourceService.GetBitmapSource(name));
                }
                else
                {
                    _imageList.Add(null);
                }
            }
        }
Exemplo n.º 4
0
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     if (PresentationResourceService.InstanceAvailable)
     {
         var imgSource = PresentationResourceService.GetBitmapSource(_key);
         return(new System.Windows.Controls.Image
         {
             Height = 16,
             Width = 16,
             Source = imgSource
         });
     }
     else
     {
         return(new Image());
     }
 }