in src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions/Core/GoToStateAction.cs [102:136]
public object Execute(object sender, object parameter)
{
if (string.IsNullOrEmpty(this.StateName))
{
return false;
}
if (this.ReadLocalValue(GoToStateAction.TargetObjectProperty) != DependencyProperty.UnsetValue)
{
Control control = this.TargetObject as Control;
if (control == null)
{
return false;
}
return VisualStateUtilities.GoToState(control, this.StateName, this.UseTransitions);
}
FrameworkElement element = sender as FrameworkElement;
if (element == null || !EventTriggerBehavior.IsElementLoaded(element))
{
return false;
}
Control resolvedControl = VisualStateUtilities.FindNearestStatefulControl(element);
if (resolvedControl == null)
{
throw new InvalidOperationException(string.Format(
CultureInfo.CurrentCulture,
ResourceHelper.GoToStateActionTargetHasNoStateGroups,
element.Name));
}
return VisualStateUtilities.GoToState(resolvedControl, this.StateName, this.UseTransitions);
}