public void DataContextChangedHandler(global::Windows.UI.Xaml.FrameworkElement sender, global::Windows.UI.Xaml.DataContextChangedEventArgs args) { global::MyWeather.Models.WeatherItem data = args.NewValue as global::MyWeather.Models.WeatherItem; if (args.NewValue != null && data == null) { throw new global::System.ArgumentException("Incorrect type passed into template. Based on the x:DataType global::MyWeather.Models.WeatherItem was expected."); } this.SetDataRoot(data); this.Update(); }
// Update methods for each path node used in binding steps. private void Update_(global::MyWeather.Models.WeatherItem obj, int phase) { this.bindingsTracking.UpdateChildListeners_(obj); if (obj != null) { if ((phase & (NOT_PHASED | DATA_CHANGED | (1 << 0))) != 0) { this.Update_Day(obj.Day, phase); this.Update_Weather_pic(obj.Weather_pic, phase); this.Update_Weather(obj.Weather, phase); this.Update_Air_temperature(obj.Air_temperature, phase); } } }
public void UpdateChildListeners_(global::MyWeather.Models.WeatherItem obj) { MainPage_obj13_Bindings bindings; if (WeakRefToBindingObj.TryGetTarget(out bindings)) { if (bindings.dataRoot != null) { ((global::System.ComponentModel.INotifyPropertyChanged)bindings.dataRoot).PropertyChanged -= PropertyChanged_; } if (obj != null) { bindings.dataRoot = obj; ((global::System.ComponentModel.INotifyPropertyChanged)obj).PropertyChanged += PropertyChanged_; } } }
public void PropertyChanged_(object sender, global::System.ComponentModel.PropertyChangedEventArgs e) { MainPage_obj13_Bindings bindings; if (WeakRefToBindingObj.TryGetTarget(out bindings)) { string propName = e.PropertyName; global::MyWeather.Models.WeatherItem obj = sender as global::MyWeather.Models.WeatherItem; if (global::System.String.IsNullOrEmpty(propName)) { if (obj != null) { bindings.Update_Day(obj.Day, DATA_CHANGED); bindings.Update_Weather_pic(obj.Weather_pic, DATA_CHANGED); bindings.Update_Weather(obj.Weather, DATA_CHANGED); bindings.Update_Air_temperature(obj.Air_temperature, DATA_CHANGED); } } else { switch (propName) { case "Day": { if (obj != null) { bindings.Update_Day(obj.Day, DATA_CHANGED); } break; } case "Weather_pic": { if (obj != null) { bindings.Update_Weather_pic(obj.Weather_pic, DATA_CHANGED); } break; } case "Weather": { if (obj != null) { bindings.Update_Weather(obj.Weather, DATA_CHANGED); } break; } case "Air_temperature": { if (obj != null) { bindings.Update_Air_temperature(obj.Air_temperature, DATA_CHANGED); } break; } default: break; } } } }
// MainPage_obj13_Bindings public void SetDataRoot(global::MyWeather.Models.WeatherItem newDataRoot) { this.bindingsTracking.ReleaseAllListeners(); this.dataRoot = newDataRoot; }