Data binding Windows Phone 7中的列表框未更新

Data binding Windows Phone 7中的列表框未更新,data-binding,windows-phone-7,Data Binding,Windows Phone 7,我有一个奇怪的错误,我想不出来 我正在创建一个Windows Phone 7应用程序,其中我可以动态创建包含列表框的数据透视项 以下是守则- PivotItems = new ObservableCollection<StatusItem>(); DataTemplate itemTemplate = App.Current.Resources["PivotItemTemplate"] as DataTemplate; ListBox

我有一个奇怪的错误,我想不出来

我正在创建一个Windows Phone 7应用程序,其中我可以动态创建包含列表框的数据透视项

以下是守则-

        PivotItems = new ObservableCollection<StatusItem>();
        DataTemplate itemTemplate = App.Current.Resources["PivotItemTemplate"] as DataTemplate;
        ListBox itemBox = new ListBox();
        itemBox.ItemsSource = PivotItems;
        itemBox.ItemTemplate = itemTemplate;
        CorePivotItem = new PivotItem() { Header = header, Content = itemBox };
PivotItems=新的ObservableCollection();
DataTemplate itemTemplate=App.Current.Resources[“PivotItemTemplate”]作为DataTemplate;
ListBox itemBox=新建ListBox();
itemBox.ItemsSource=数据透视项;
itemBox.ItemTemplate=ItemTemplate;
CorePivotItem=new PivotItem(){Header=Header,Content=itemBox};
现在,当我向数据透视项添加对象时,UI中不会显示任何内容

很抱歉第一次不清楚-这是DataTemplate绑定-

   <DataTemplate x:Key="PivotItemTemplate">
        <StackPanel >
            <Image Source="{Binding URL}" ></Image>
            <TextBlock Text="{Binding Text}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
        </StackPanel>
    </DataTemplate>


我正在将数据透视项添加到另一个绑定到数据透视控件的OC。当我轻弹数据透视项时,所有列表都显示良好。基本上我猜OC不会触发列表框的刷新。我可以使用BindingExpressions强制刷新列表吗?

您的代码不会显示将新创建的
数据透视项添加到
数据透视中。这就是你没有做的

当然,这并不假定在其他地方尚未定义
CorePivotItem


你能展示你的XAML和其他C代码吗?这样我们就可以了解完整情况。

你的商品模板确实可以吗?如果你没有指定它(使用默认值),你会看到一些东西吗?这是不是和增加问题清晰度的问题相同。谢谢你们的帮助!