I am trying to bind listbox from xaml, but seems I am doing something wrong with it. Here is my XAML Page.
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<phone:Pivot Title="MY APPLICATION">
<!--Pivot item two-->
<phone:PivotItem Header="item2">
<Grid>
<ListBox Foreground="Black" x:Name="ls" ItemsSource="{Binding MyLang}" >
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Language}"></TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</phone:PivotItem>
</phone:Pivot>
</Grid>
code behind
DataSource ds = null;
public List<TranslationLanguage> MyLang;
public PivotPage2()
{
ds = new DataSource();
MyLang = ds.getTranslationLanguages(); //return collections and contains 13 rows
InitializeComponent();
DataContext = this;
}
public class TranslationLanguage
{
[PrimaryKey]
public byte LanguageID{get;set;}
public string Language{get;set;}
public string Description { get; set; }
public bool IsActive { get; set; }
public FlowDirection FlowDirection { get; set; }
public string DownloadURL { get; set; }
public bool IsDownloaded { get; set; }
public string ImagePath { get; set; }
}
I am really confused why it doesn't work at all?