public void ApplyInterpolateToState(object firstStateUncasted, object secondStateUncasted, float time, InterpolationType interpolationType, Easing easing) { // We gotta find the type that this is: string categoryName = "Uncategorized"; StateSave firstState = (StateSave)firstStateUncasted; StateSave secondState = (StateSave)secondStateUncasted; Type type = firstState.GetType(); categoryName = type.Name; foreach (var uncastedControl in this.StatePanel.Controls) { if (uncastedControl is StateCategoryControl) { StateCategoryControl control = uncastedControl as StateCategoryControl; if (control.ContainsState(firstState) && control.ContainsState(secondState)) { control.ApplyInterpolateToState(firstState, secondState, time, interpolationType, easing); break; } } } }