Hello all i am working on windows phone 8 app, i am facing a issue, i am loading some data in my pivot item and if user tap a user control opens and i modify the data through user control. Data is saving into the database successfully but my pivot item is not updating immediately. i am using observable collection as following.
ObservableCollection i used like following in mypivot.xaml.cs file
ObservableCollection<MyWrapper> saveinfo = new ObservableCollection<MyWrapper>();
public ObservableCollection<MyWrapper> savedWordBankCollection
{ get { return saveinfo; } }
//MyWrapper class structure
public class MyWrapper: INotifyPropertyChanged
{
private string desc;
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyChange(PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
PropertyChanged(this, e);
}
public string Name { get; set; }
public string NameDescription
{
get { return desc; }
set
{
desc = value;
NotifyChange(new PropertyChangedEventArgs("NameDescription"));
}
}
public string NameId { get; set; }
public string NameLocId { get; set; }
}
Now as following i am loading data into my pivot item in pivot page
private void LoadWordbank()
{
List<MysecondWrapper> dbData = helper.FetchAllName(thisApp.CurrentName.Id);
if (dbData.Count != 0)
{
foreach (MySerconWrapper item in dbData)
{
saveinfo.Add(new MyWrapper { NameLocalId = item.Id.ToString(), Name= item.Name, NameDescription = item.Description, NameId = thisApp.CurrentName.Id});
}
}
}
mypivot.xaml as follwoing. i am not writing full code but how i have assigned the attributes that i am showing.
<TextBlock x:Name="wordbankStored" Grid.Column="0" Grid.Row="0" Text="{Binding Name}"/>
<Button x:Name="btnWordDescription" Grid.Row="1" Grid.Column="0" Content="{Binding NameDescription}"
Tag="{Binding}" Click="btnNameDescription_Click"/>
In above textblocks i tried:
Content="{Binding NameDescription, Mode=TwoWay}"
but it didn't work so i have removed. on btnNameDescription_Click my user control opens and i can save data in my local db of wp8 but it does not show immediately in my pivot. Please give me suggession what and how to do ? where i am wrong. need help.