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