【发布时间】:2012-03-01 14:53:08
【问题描述】:
我会尽力解释我的问题...抱歉谷歌的英文翻译。
我想动态显示gps listBox中的值
我有一个类,股票值gps:
public class LocationManager : INotifyPropertyChanged
另一个具有名称和值的:
public class GpsItem: INotifyPropertyChanged
第三类:
public class GpsItems: ObservableCollection<GpsItem>
我的列表框有 ItemsSource 作为我的第三类
ListBox.ItemsSource = new GpsItems();
xaml:
<ListBox x:Name="ListBox" Background="#BF000000" Tap="LsbAllCases_Tap">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,10" Width="Auto" Height="Auto" Orientation="Horizontal">
<TextBlock Text="{Binding Name, Mode="OneWay"}" VerticalAlignment="Center" HorizontalAlignment="Left" />
<TextBlock Text="{Binding Value, Mode="OneWay"}" HorizontalAlignment="Right" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
执行中显示的值,但不是动态的。
我已经实现了 INotifyPropertyChanged 接口:
// Declare the PropertyChanged event
public event PropertyChangedEventHandler PropertyChanged;
// NotifyPropertyChanged will raise the PropertyChanged event passing the
// source property that is being updated.
public void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
我不知道该怎么办...帮助 提前谢谢你
【问题讨论】:
标签: c# silverlight windows-phone-7 gps windows-phone-7.1