We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

HubTile SfMosaicTile binding ImageList

Hi!
I have a GridView with HubTiles .. all goes well.
Now I'm trying to bind a List<string> to the ImageList

<syncFusion:SfMosaicTile  Width="173" 
                           Height="171" Header="{Binding Name}" ImageList="{Binding Icons}" >
                         
                        </syncFusion:SfMosaicTile>

But it does not show the images..
But if I do the usual 

<syncFusion:SfMosaicTile  Width="173" 
                           Height="171" Header="{Binding Name}" >
                            <syncFusion:SfMosaicTile.ImageList>
                                <syncFusion:ImageList>
                                    <x:String>ms-appdata:///local/M_Photos_WP_20131117_15_05_41_Refocus.jpg</x:String>
                                </syncFusion:ImageList>
                            </syncFusion:SfMosaicTile.ImageList>
                        </syncFusion:SfMosaicTile>
It works

Any tips?







11 Replies

VV Vignesh V Syncfusion Team February 24, 2014 01:04 PM UTC

Hi Cristovao,

 

We have prepared a sample to address your requirement 'To bind image list for SfMosaicTile'. In the sample we have created a property of type 'ImageList' and binded the list to it.Please find the sample in below attachment.

 

Please let us know if you have any queries.

 

Regards,

Vignesh V


Attachment: MossaicTile_115900_3de7dd8c.zip


CR cristovao February 24, 2014 02:05 PM UTC

Thank you for your solution

I've come across a complementary ideia. binding to a List<anything> and use a Converter do transform to ImageList

<syncFusion:SfMosaicTile  Width="173" 
                            Height="171" Header="{Binding Name}" ImageList="{Binding Converter={StaticResource ListToImageListConverter}}" />
public sealed class ListToImageListConverter : IValueConverter
   {
       public object Convert(object value, Type targetType, object parameter, string language)
       {
           ImageList list = new ImageList();
           var i = (Domain.Models.Ui.Item)value;
           if (i.IsFolder)
           {
               List<string> images = i.Icons;
               Debug.WriteLine(i.Path);
               int max = 0;
               if (images != null && images.Count > 0)
                   foreach (var item in images)
                   {
                       list.Add(item);
                       max++;
                       if (max > 8break;
                   }
               else
                   list.Add("ms-appdata:///local/default.jpg");
           }            else            {                list.Add("ms-appdata:///local/default.jpg");            }            return list;        }        public object ConvertBack(object value, Type targetType, object parameter, string language)        {            return !(value is bool && (bool)value);        }


VV Vignesh V Syncfusion Team February 25, 2014 05:17 AM UTC

Hi Cristovao,

 

Thank you for your update. Please let us know if you need further assistance.

 

Regards,
Vignesh V

 

 



MD Manuel De Leon replied to Vignesh V September 1, 2015 03:08 AM UTC

Hi Cristovao,

 

Thank you for your update. Please let us know if you need further assistance.

 

Regards,
Vignesh V

 

 


Hi,
   Is there a way to bind the images into the imagelist somewhere from the pictures library. Instead of the string, use the BitmapImage as a stream?

thanks,
Manny


MS Mariappan S Syncfusion Team September 1, 2015 09:14 AM UTC

Hi Manuel,

We have prepared a workaround sample which tries to meet your requirement. In this sample we have created a property of type 'ObservableCollection<Image>' and binded the image collection to  ImageList property of SfMosaicTile control. We have used IValuConverter to convert from Image observable collection to ImageList collection. If your requirement is different from this sample, please provide more information about your requirement. It would be very helpful for us to resolve your problem earlier.

Please download the sample from the below link.

Sample link: MossaicTile_115900


Please let us know if you need further assistance.

Regards,
Mariappan S.  


MD Manuel De Leon replied to Mariappan S September 1, 2015 10:52 AM UTC

Hi Manuel,

We have prepared a workaround sample which tries to meet your requirement. In this sample we have created a property of type 'ObservableCollection<Image>' and binded the image collection to  ImageList property of SfMosaicTile control. We have used IValuConverter to convert from Image observable collection to ImageList collection. If your requirement is different from this sample, please provide more information about your requirement. It would be very helpful for us to resolve your problem earlier.

Please download the sample from the below link.

Sample link: MossaicTile_115900


Please let us know if you need further assistance.

Regards,
Mariappan S.  

Hi Mariappan,
   Thanks for the prompt reply and sample. I will try the sample and replacing the Bitmap image source from URI to storage file. This storage file could be located somewhere in the local disk or one drive.

Manny


MS Mariappan S Syncfusion Team September 2, 2015 01:53 PM UTC

Hi Manuel,

Could you please confirm whether you are trying to load from DocumentLibrary images. If your requirement different from loading images from document library. Could please provide more information about your requirement. It would be very helpful for us to resolve your problem earlier.

Please let us know if you need further assistance.

Regards,
Mariappan S


MD Manuel De Leon September 3, 2015 03:30 PM UTC

Hi Mariappan,
    Yes, I am trying to load the images from the pictures library. It seems it won't load like this

<Notification:ImageList>

    <x:String>C:\\Users\\Manny\\Pictures\\DSC_0411.jpg</x:String>

</Notification:ImageList>


Please help.



MS Mariappan S Syncfusion Team September 4, 2015 12:27 PM UTC

Hi Manuel,

When the path is set as string, it will work only for the images stored in Local, Roaming, Temp app data and App(inside the application project) locations. For folders like Downloads, Picture library, Video library, Document library and Music library we have to set the Source property of Image element through C# as BitmapImage. ImageList of SfMosaicTile is a collection of string, bound to Source property of Image element in control template. So passing a string path for a Picture library image will not work.

Please let us know if you need further assistance on this.

Regards,
Mariappan S.


MD Manuel De Leon September 4, 2015 03:22 PM UTC

Hi Mariappan,
     I understand your explanation. So the control will not support the images that are located outside the package. Is there a way around this scenario?
All I need is to be able to use the images in the pictures library.

Thanks,
Manny


MS Mariappan S Syncfusion Team September 7, 2015 09:45 AM UTC

Hi Manuel,

We can only show images by using the ImageList property as a URL string. Currently we do not have any work around to show the Picture Library images in ImageList property of SfMosaicTile.

Please let us know if you need further assistance.

Regards,
Mariappan S.

Loader.
Live Chat Icon For mobile
Up arrow icon