C# 使用本地数据库中的更新数据重新加载LongListSelector-Windows Phone 8

C# 使用本地数据库中的更新数据重新加载LongListSelector-Windows Phone 8,c#,windows-phone-8,longlistselector,C#,Windows Phone 8,Longlistselector,我的Windows Phone 8应用程序中的longlistselector有问题。 从longlistselector中选择并编辑记录并将更改提交到我的本地数据库后,除非关闭并重新打开应用程序,否则longlistselector不会显示更新的名称。数据肯定正在更新,只是没有显示出来。在应用程序仍处于打开状态时,是否有方法选择列表?这是列表的Xaml: <!--ContentPanel - place additional content here--> <Gri

我的Windows Phone 8应用程序中的longlistselector有问题。 从longlistselector中选择并编辑记录并将更改提交到我的本地数据库后,除非关闭并重新打开应用程序,否则longlistselector不会显示更新的名称。数据肯定正在更新,只是没有显示出来。在应用程序仍处于打开状态时,是否有方法选择列表?这是列表的Xaml:

 <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <phone:LongListSelector x:Name="llsModules"
                               Margin="0,0,-12,0"
                               ItemsSource="{Binding Modules}"
                               SelectionChanged="llsModules_SelectionChanged">
            <phone:LongListSelector.ItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="0,0,0,17">
                        <StackPanel Orientation="Horizontal">
                            <Grid HorizontalAlignment="Stretch" Width="420"  >                             
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="100"/>
                                </Grid.ColumnDefinitions>
                            <TextBlock Text="{Binding Name,StringFormat='Name: {0}'}"
                                TextWrapping="Wrap"
                                MaxWidth="300"
                                Style="{StaticResource PhoneTextLargeStyle}"
                                       HorizontalAlignment="Left"
                                       Grid.Row="1"
                                       />
                            </Grid>
                        </StackPanel>
这就是数据模型

 [Table(Name = "Modules")]
    public class Modules : INotifyPropertyChanged, INotifyPropertyChanging
    {
        public Modules()
        {
        }

        private int _id;
        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int Id
        {
            get
            {
                return _id;
            }
            set
            {
                if (_id != value)
                {
                    NotifyPropertyChanging("Id");
                    _id = value;
                    NotifyPropertyChanged("Id");
                }
            }
        }

        private string _name;
        [Column(DbType = "nvarchar(255)", CanBeNull = false)]
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                if (value == "")
                    throw new Exception("Module Name is a required field");

                if (_name != value)
                {
                    NotifyPropertyChanging("Name");
                    _name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }

非常感谢

在Xaml中,将用于显示名称的绑定更改为双向

Text="{Binding Name, Mode=TwoWay, StringFormat='Name: {0}'}"
这让xaml知道如何监视
Name
属性的InotifyPropertyChanges

Text="{Binding Name, Mode=TwoWay, StringFormat='Name: {0}'}"