Skip to main content
ApplicationData.DataChanged | datachanged event

Applies to Windows and Windows Phone

Occurs when roaming application data is synchronized.

Syntax


function onDataChanged(eventArgs) { /* Your code */ }
 
// addEventListener syntax
applicationData.addEventListener("datachanged", onDataChanged);
applicationData.removeEventListener("datachanged", onDataChanged);
 
- or -

applicationData.ondatachanged = onDataChanged;

public event TypedEventHandler<ApplicationData, Object> DataChanged

Public Event DataChanged As TypedEventHandler(Of ApplicationData, Object)

public:
event TypedEventHandler<ApplicationData, Object>^ DataChanged {
   Windows::Foundation::EventRegistrationToken add(TypedEventHandler<ApplicationData, Object>^ value);
   void remove(Windows::Foundation::EventRegistrationToken token);
}

Event information

Delegate TypedEventHandler<ApplicationData, Object>

Examples

This example registers for the DataChanged | datachanged event.


var applicationData = Windows.Storage.ApplicationData.current;

function initialize() 
{
    applicationData.addEventListener("datachanged", datachangeHandler);
}

function dataChangeHandler(eventArgs)
{
    // TODO: Refresh your data
}

void InitHandlers()
{
   Windows.Storage.ApplicationData.Current.DataChanged += 
      new TypedEventHandler<ApplicationData, object>(DataChangeHandler);
}

void DataChangeHandler(Windows.Storage.ApplicationData appData, object o)
{
   // TODO: Refresh your data
}

Private Sub InitHandlers()
    AddHandler Windows.Storage.ApplicationData.Current.DataChanged, AddressOf DataChangeHandler
End Sub

Private Sub DataChangeHandler(ByVal appData As Windows.Storage.ApplicationData, ByVal o As Object)
    ' TODO: Refresh your data
End Sub

void MainPage::InitHandlers()
{
   Windows::Storage::ApplicationData::Current->DataChanged += 
      ref new TypedEventHandler<Windows::Storage::ApplicationData^, Object^>
      (this, &MainPage::DataChangeHandler);
}

void MainPage::DataChangeHandler(Windows::Storage::ApplicationData^ appData, Object^)
{
   // TODO: Refresh your data
}

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.winmd

DLL

Windows.Storage.ApplicationData.dll

See also

Tasks
Quickstart: Roaming application data (JavaScript)
Quickstart: Roaming application data (C#/VB/C++)
Concepts
Application data overview
Reference
ApplicationData