ApplicationData.DataChanged ApplicationData.DataChanged ApplicationData.DataChanged ApplicationData.DataChanged ApplicationData.DataChanged Event

Definition

Occurs when roaming application data is synchronized.

public : event TypedEventHandler<ApplicationData, object> DataChanged
// Register
event_token DataChanged(TypedEventHandler<ApplicationData, object> const& handler) const;

// Revoke with event_token
void DataChanged(event_token const& cookie) const;

// Revoke with event_revoker
DataChanged_revoker DataChanged(auto_revoke_t, TypedEventHandler<ApplicationData, object> const& handler) const;
public event TypedEventHandler<ApplicationData, object> DataChanged
Public Event DataChanged As TypedEventHandler (Of ApplicationData, object)
function onDataChanged(eventArgs){/* Your code */}


applicationData.addEventListener("datachanged", onDataChanged);
applicationData.removeEventListener("datachanged", onDataChanged);

Examples

This example registers for the DataChanged event.

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

void DataChangeHandler(Windows.Storage.ApplicationData appData, object o)
{
   // TODO: Refresh your data
}
void MainPage::InitHandlers()
{
    Windows::Storage::ApplicationData::Current().DataChanged({ this, &MainPage::DataChangeHandler });
}

void MainPage::DataChangeHandler(Windows::Storage::ApplicationData const& /* appData */, Windows::Foundation::IInspectable const& /* object */)
{
    // TODO: Refresh your data.
}
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
}
var applicationData = Windows.Storage.ApplicationData.current;

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

function dataChangeHandler(eventArgs)
{
    // 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

Remarks

The event handler receives an ApplicationData object that provides access to the changed roaming data containers. For more information, see Roaming data.

See also