I have a list box XAML of which looks like this
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<ListBox HorizontalAlignment="Left" Margin="12,12,0,0" Name="ComplaintslistBox" VerticalAlignment="Top">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Width="400" BorderThickness="1">
<Button.Content>
<StackPanel Orientation="Horizontal">
<StackPanel>
<Image Source="{Binding Type}" Width="30" Height="30"></Image>
</StackPanel>
<StackPanel>
<TextBlock Text="{Binding Head}" Width="300"></TextBlock>
</StackPanel>
</StackPanel>
</Button.Content>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
now the problem is it is binding "Head" but not binding the "Type"
Type variable contains path to the image which is to be shown....
class looks like this
public class Complaints
{
public string Id { get; set; }
public string Type { get; set; }
public string Head { get; set; }
//public string Desc { get; set; }
public string lat { get; set; }
public string lon { get; set; }
public string wardNo { get; set; }
public string wardName { get; set; }
public string creator { get; set; }
public string url { get; set; }
public string catId { get; set; }
public string subCatId { get; set; }
public int commentCount { get; set; }
public int solutionCount { get; set; }
public int affectedCount { get; set; }
public Complaints() { }
public Complaints(Complaints complaints)
{
this.Id = complaints.Id;
this.Head = complaints.Head;
//this.Desc = complaints.Desc;
switch (complaints.Type)
{
case "Reported":
this.Type = "icons/icon_red.png";
break;
case "Reopened":
this.Type = "icons/icon_black.png";
break;
case "Resolved":
this.Type = "icons/icon_green.png";
break;
default:
this.Type = "icons/icon_blue.png";
break;
}
this.wardNo = complaints.wardNo;
this.wardName = complaints.wardName;
this.lat = complaints.lat;
this.lon = complaints.lon;
this.catId = complaints.catId;
this.subCatId = complaints.subCatId;
this.url = complaints.url;
this.creator = complaints.creator;
this.affectedCount = complaints.affectedCount;
this.commentCount = complaints.commentCount;
this.solutionCount = complaints.solutionCount;
}
}
Thanks