/// <summary> /// Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred. /// </summary> /// <remarks> /// Override this to unhook functionality from the AssociatedObject. /// </remarks> protected override void OnDetaching() { DebugWriterHelper.WriterLine("OnDetaching"); base.OnDetaching(); AssociatedObject.GotFocus -= OnGotFocus; AssociatedObject.LostFocus -= OnLostFocus; }
/// <summary> /// Called after the behavior is attached to an AssociatedObject. /// </summary> /// <remarks> /// Override this to hook up functionality to the AssociatedObject. /// </remarks> protected override void OnAttached() { DebugWriterHelper.WriterLine("OnAttached"); base.OnAttached(); AssociatedObject.GotFocus += OnGotFocus; AssociatedObject.LostFocus += OnLostFocus; OnLostFocus(null, null); }
private static void WaterMarkTextCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { DebugWriterHelper.WriterLine("WaterMarkTextCallback"); var textBox = (TextBox) dependencyObject; if (!textBox.IsLoaded) { textBox.GotFocus += TextBoxOnGotFocus; textBox.LostFocus += TextBoxOnLostFocus; textBox.TextChanged += TextBoxOnTextChanged; textBox.Unloaded += TextBoxOnUnloaded; } }
private void BehaviorTextBox_OnUnloaded(object sender, RoutedEventArgs e) { DebugWriterHelper.WriterLine("BehaviorTextBox_OnUnloaded"); }
private void BehaviorTextBox_OnInitialized(object sender, EventArgs e) { DebugWriterHelper.WriterLine("BehaviorTextBox_OnInitialized"); }
private void AttachPropertyTextBox_OnUnloaded(object sender, RoutedEventArgs e) { DebugWriterHelper.WriterLine("AttachPropertyTextBox_OnUnloaded"); }
private void AttachPropertyTextBox_OnInitialized(object sender, EventArgs e) { DebugWriterHelper.WriterLine("AttachPropertyTextBox_OnInitialized"); }