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(); }
protected override void OnAttached() { if (!View.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(); }