/// <summary> /// Called after the action is attached to an AssociatedObject. /// </summary> #if WinRT81 protected override void OnAttached() { if (!View.InDesignMode) { Parameters.Attach(AssociatedObject); Parameters.OfType <Parameter>().Apply(x => x.MakeAwareOf(this)); if (View.ExecuteOnLoad(AssociatedObject, ElementLoaded)) { // Not yet sure if this will be needed //var trigger = Interaction.GetTriggers(AssociatedObject) // .FirstOrDefault(t => t.Actions.Contains(this)) as EventTrigger; //if (trigger != null && trigger.EventName == "Loaded") // Invoke(new RoutedEventArgs()); } View.ExecuteOnUnload(AssociatedObject, ElementUnloaded); } base.OnAttached(); }
protected override void OnAttached() { if (!Bootstrapper.IsInDesignMode) { Parameters.Attach(AssociatedObject); Parameters.Apply(x => x.MakeAwareOf(this)); if ((bool)AssociatedObject.GetValue(View.IsLoadedProperty)) { ElementLoaded(null, null); } else { AssociatedObject.Loaded += ElementLoaded; } } base.OnAttached(); }
/// <summary> /// Called after the action is attached to an AssociatedObject. /// </summary> protected override void OnAttached() { if (!Execute.InDesignMode) { Parameters.Attach(AssociatedObject); Parameters.Apply(x => x.MakeAwareOf(this)); if (View.ExecuteOnLoad(AssociatedObject, ElementLoaded)) { var trigger = Interaction.GetTriggers(AssociatedObject) .FirstOrDefault(t => t.Actions.Contains(this)) as EventTrigger; if (trigger != null && trigger.EventName == "Loaded") { Invoke(new RoutedEventArgs()); } } } base.OnAttached(); }
/// <summary> /// Called after the action is attached to an AssociatedObject. /// </summary> protected override void OnAttached() { if (!View.InDesignMode) { Parameters.Attach(AssociatedObject); Parameters.OfType <Parameter>().Apply(x => x.MakeAwareOf(this)); // This is a real hack, we don't have access to a Loaded event so // working out when the "visual tree" is active doesn't really happen // We don't have many events to choose from. Thankfully EventHandler bindingContextChanged = null; bindingContextChanged = (s, e) => { AssociatedObject.BindingContextChanged -= bindingContextChanged; ElementLoaded(); }; AssociatedObject.BindingContextChanged += bindingContextChanged; } base.OnAttached(); }