The problem is you need to run the update asynchronously in the ui thread.
void MainPage::DataChangedHandler(Windows::Storage::ApplicationData^ appData, Object^)
{
Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler(
[this]()
{
UpdateUIElements();
}));
}