public static PossibleErrorAdorner Add(UIElement element) { PossibleErrorAdorner result = null; AdornerLayer al = AdornerLayer.GetAdornerLayer(element); if (al != null) { Adorner[] adorners = al.GetAdorners(element); if (adorners != null && adorners.Length != 0) { foreach (Adorner a in adorners) { if (a is PossibleErrorAdorner) { result = a as PossibleErrorAdorner; break; } } } if (result == null) { result = new PossibleErrorAdorner(element); al.Add(result); } } return result; }
private void TimeTextBox_Loaded(object sender, System.Windows.RoutedEventArgs e) { if (IsInputMaskEnabled) { this.Mask = "00:00"; } this.MinWidth = ApplicationManager.Instance.CellWidth; if (!FreeWidth) { this.MaxWidth = this.ActualWidth; } m_PossibleErrorAdorner = Adorners.PossibleErrorAdorner.Add(this); }