What your code seems missing is setting DataContext
. Generally, binding resolves path from DataContext
property. When you bind ItemsSource
property this way :
<ListBox x:Name="TotalItems" Grid.Row="0" ItemsSource="{Binding Items_OC}" ...>
application will search Items_OC
property of ListBox
's DataContext
. Currently, it won't find the property because DataContext
is null
. You can set DataContext
to xaml.cs
file from C# code like this :
this.DataContext = this;
or from XAML :
<phone:PhoneApplicationPage
.......
.......
DataContext="{Binding RelativeSource={RelativeSource Self}}"
/>