问一个数据绑定的初级问题....求大大帮解答~~
我用webservice 获取到数据后 然后添加到ObservableCollection这个集合里面
如下
ObservableCollection<Announcement> list = new ObservableCollection<Announcement>()
然后绑定
<phone:PanoramaItem Header="公告" Width="420" Loaded="PanoramaItem_Loaded">
<ListBox Name="ggList"
ItemTemplate="{StaticResource GgListBoxDatatemplate}" >
</ListBox>
</phone:PanoramaItem>
<DataTemplate x:Key="GgListBoxDatatemplate">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="对象" FontSize="9pt" Grid.Row="1" Grid.Column="0"></TextBlock>
<TextBlock x:Name="TxtTo" Text="{Binding To}" Grid.Row="1" Grid.Column="1"></TextBlock>
<TextBlock Text="内容" FontSize="9pt" Grid.Row="2" Grid.Column="0"></TextBlock>
<TextBlock x:Name="TxtContent" Text="{Binding Content}" Grid.Row="2" Grid.Column="1"></TextBlock>
<TextBlock Grid.Row="3" Text="{Binding CreateTime}" Grid.Column="0" Grid.ColumnSpan="2"></TextBlock>
</Grid>
</DataTemplate>