Example #1
0
        /// <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;
        }
Example #2
0
        /// <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);
        }
Example #3
0
        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;
            }
        }
Example #4
0
 private void BehaviorTextBox_OnUnloaded(object sender, RoutedEventArgs e)
 {
     DebugWriterHelper.WriterLine("BehaviorTextBox_OnUnloaded");
 }
Example #5
0
 private void BehaviorTextBox_OnInitialized(object sender, EventArgs e)
 {
     DebugWriterHelper.WriterLine("BehaviorTextBox_OnInitialized");
 }
Example #6
0
 private void AttachPropertyTextBox_OnUnloaded(object sender, RoutedEventArgs e)
 {
     DebugWriterHelper.WriterLine("AttachPropertyTextBox_OnUnloaded");
 }
Example #7
0
 private void AttachPropertyTextBox_OnInitialized(object sender, EventArgs e)
 {
     DebugWriterHelper.WriterLine("AttachPropertyTextBox_OnInitialized");
 }