2011-12-21 2 views
2

일부 데이터 바인딩을 시도하고 있지만 표시 할 이미지를 가져올 수 없습니다. 이것은 XAML의 모습입니다 :xaml : 작업 할 이미지 바인딩을 가져올 수 없습니다.

이 코드 숨김의 모습입니다
<ListBox Name="tListBox" Margin="0,0,-12,0"> 
    <ListBox.ItemTemplate> 
     <DataTemplate> 
      <StackPanel Orientation="Horizontal" Margin="0,0,0,17"> 
       <Image Source="{Binding imgUri}" Margin="2" Height="100" Width="100" /> 
       <!--<Image Source="images/weapons/tmp.png" Height="100" Width="100" />--> 
       <StackPanel Width="311"> 
        <TextBlock Text="{Binding wName}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" /> 
        <TextBlock Text="{Binding price}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/> 
       </StackPanel> 
      </StackPanel> 
     </DataTemplate> 
    </ListBox.ItemTemplate> 
</ListBox> 

: 이미지를이 이름을 실행하는 경우

public partial class MainPage : PhoneApplicationPage 
{ 
    List<Weapon> tList; 
    List<Weapon> cList; 
    List<Weapon> eList; 

    // Constructor 
    public MainPage() 
    { 
     InitializeComponent(); 
     loadData(); 
    } 
    public void loadData() 
    { 
     tList = new List<Weapon>(); 
     tList.Add(new Weapon 
     { 
      wName = "Glock 18", 
      imageUri = "images/weapons/glock18.png", 
      price = "$400" 
     }); 
     tList.Add(new Weapon 
     { 
      wName = "USP tactical", 
      imageUri = "images/weapons/usptactical.png", 
      price = "$500", 
     }); 
     tListBox.ItemsSource = tList; 
    } 
} 
public class Weapon 
{ 
    public string wName { get; set; } 
    public string imageUri { get; set; } 
    public string price { get; set; } 
} 

과 가격이 표시됩니다,하지만. xaml에서 주석 처리 된 행은 누구나 내가 뭘 잘못하고 있는지 정정 해 줄 수 있습니까?

답변

0

실수를 발견했습니다. xaml에 imgUri, codebehind에 imageUri - 다른 변수 이름. 매우 당황 스럽네요;)