2012-02-05 2 views
1

창 전화 7 디자인으로 허브 타일에 이미지를 넣으려고했지만 전자 북을 정확히 따르면서 이미지를 볼 수 없었지만 이미지를 넣을 수 없었습니다. 누구든 제발?이미지를 허브 타일에 넣을 수 없습니다.

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; 
     } 
    } 

누구나 할 수있는 클래스에 대한

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" 
       } 
      }; 

뒤에

XAML 코드

<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> 

코드 PLS. 고마워요

+0

이미지는 콘텐츠로 저장됩니까? – Ku6opr

+0

이미지가/images에 추가되었습니다. –

+0

콘텐츠/리소스 옵션을 의미했습니다. – Ku6opr

답변

1

당신은 길을 판단하는 방법으로 판단 할 때 "Build Action"이라고 말합니다. 표시하려고하는 이미지의 "Build Action"이 content로 설정되어 있는지 확인하고 싶을 수 있습니다.

+0

답장을 보내 주셔서 감사합니다. 확인했습니다. 빌드 작업이 리소스로 설정되었습니다. 고마워요. 따라서 기본 설정은 내용을 변경하는 것입니다. –

+2

또는 "yourassemblyname; component/Images/Hard.jpg"와 같은 이미지 경로를 설정하십시오. – Ku6opr

+1

@CarsonLee 기본적으로 리소스로 추가됩니다. 그러나 성능을 위해 콘텐츠로 변경하고 질문에 사용한 경로를 따라야합니다. 이유는 앱에 리소스로 추가 할 때 앱의 dll 파일에 저장되므로 앱이로드되는 데 걸리는 시간이 길어지기 때문입니다. – loyalpenguin

관련 문제