protected virtual void UpdateStates(bool useTransitions) { if (IsOffline) { _actualValueIndicator.Binding(RangeBase.ValueProperty, this, x => x.OfflineActualValue); _actualValueTextBlock.Binding(TextBlock.TextProperty, this, x => x.OfflineActualValue); _objectiveValueIndicator.Binding(RangeBase.ValueProperty, this, x => x.OfflineObjectiveValue); _objectiveValueTextBlock.Binding(TextBlock.TextProperty, this, x => x.OfflineObjectiveValue); VisualStateManager.GoToState(this, "OfflineMode", useTransitions); if (IsOfflineObjectiveValueChanged) { VisualStateManager.GoToState(this, "ObjectiveValueChanged", useTransitions); } else { VisualStateManager.GoToState(this, "ObjectiveValueUnchanged", useTransitions); } } else { _actualValueIndicator.Binding(RangeBase.ValueProperty, this, x => x.OnlineActualValue); _actualValueTextBlock.Binding(TextBlock.TextProperty, this, x => x.OnlineActualValue); _objectiveValueIndicator.Binding(RangeBase.ValueProperty, this, x => x.OnlineObjectiveValue); _objectiveValueTextBlock.Binding(TextBlock.TextProperty, this, x => x.OnlineObjectiveValue); if (IsFaulted) { VisualStateManager.GoToState(this, "FaultedMode", useTransitions); } else { if (IsLocked) { VisualStateManager.GoToState(this, "LockedMode", useTransitions); } else { VisualStateManager.GoToState(this, "OnlineMode", useTransitions); if (IsOnlineObjectiveValueChanged) { VisualStateManager.GoToState(this, "ObjectiveValueChanged", useTransitions); } else { VisualStateManager.GoToState(this, "ObjectiveValueUnchanged", useTransitions); } } } } switch (SideIndex) { case 0: VisualStateManager.GoToState(this, "UpperSide", useTransitions); break; case 1: VisualStateManager.GoToState(this, "LowerSide", useTransitions); break; } }