Search code examples
windows-phone-7silverlight-toolkit

Unable to put images into hub tile


I trying to put some images into the hub tile as the window phone 7 design but i found out even i follow the ebook exactly but i still unable to put the images into it. Anyone please?

XAML code

  <ListBox Grid.Row="0" x:Name="tileList">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <toolkit:WrapPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <toolkit:HubTile Title="{Binding Title}" Margin="3" Notification="{Binding Notification}"
                                        DisplayNotification="{Binding DisplayNotification}" Message="{Binding Message}" 
                                             GroupTag="{Binding GroupTag}" Source="{Binding ImageUri}"> 
                            </toolkit:HubTile>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

Code Behind

 List<TileItem> tileItems = new List<TileItem>()
            {
                new TileItem()
                {
                    ImageUri="/Images/logo.png", Title="Work Hard", Notification = "Work Hard", GroupTag="TileGroup"
                },
                new TileItem()
                {
                    ImageUri="/Images/Hard.jpg", Title="Work Smart", Notification = "Work Smart", GroupTag="TileGroup"
                },
                new TileItem()
                {
                    ImageUri="/Images/Hard.jpg",
                    Title = "Play Smart",
                    Message = "Look Smart"
                },
                new TileItem()
                {
                    ImageUri="/Images/Hard.jpg",
                    Title = "Sleep Smart",
                    Message = "Sleep Smart"
                },
                new TileItem()
                {
                    ImageUri="/Images/Hard.jpg",
                    Title = "Sleep Hard",
                    Message = "Sleep Hard"
                },
                new TileItem()
                {
                    ImageUri="/Images/Hard.jpg", Title="Play Hard", Notification = "Play Hard", GroupTag="TileGroup"
                }
            };

For the classes which be

   public class TileItem
    {
        public string ImageUri
        {
            get;
            set;
        }

        public string Title
        {
            get;
            set;
        }

        public string Notification
        {
            get;
            set;
        }

        public bool DisplayNotification
        {
            get
            {
                return !string.IsNullOrEmpty(this.Notification);
            }
        }

        public string Message
        {
            get;
            set;
        }

        public string GroupTag
        {
            get;
            set;
        }
    }

Anyone pls. Thanks


Solution

  • Judging by the way you have the path, I would say its the "Build Action". You might want to check if the image that your trying to display has its "Build Action" set to content.