Beispiel #1
0
 /// <summary>
 /// Updates the display of the cue banner based on the control's content, focus and visibility.
 /// </summary>
 /// <param name="control">The control the cue banner is attached to.</param>
 private static void UpdateAdornerState(Control control)
 {
     if (control != null)
     {
         CueBannerAdorner adorner = GetCueBannerAdorner(control);
         if (adorner != null)
         {
             if (CueBannerService.HasContent(control) || !control.IsEnabled || control.Visibility != Visibility.Visible)
             {
                 adorner.SetDisplayToHidden();
             }
             else
             {
                 if (control.IsFocused)
                 {
                     adorner.SetDisplayToDim();
                 }
                 else
                 {
                     adorner.SetDisplayToNormal();
                 }
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Event handler that adds the cue banner to the control.
        /// </summary>
        /// <param name="sender">The object where the event handler is attached.</param>
        /// <param name="e">The event data.</param>
        private static void Control_Loaded(object sender, RoutedEventArgs e)
        {
            Control          control          = sender as Control;
            AdornerLayer     adornerLayer     = AdornerLayer.GetAdornerLayer(control);
            CueBannerAdorner cueBannerAdorner = new CueBannerAdorner(control, CueBannerService.GetCueBanner(control));

            adornerLayer.Add(cueBannerAdorner);

            CueBannerService.UpdateAdornerState(control);
        }
Beispiel #3
0
        /// <summary>
        /// Event handler that updates the cue banner when the control's text is changed.
        /// </summary>
        /// <param name="sender">The object where the event handler is attached.</param>
        /// <param name="e">The event data.</param>
        private static void Control_TextChanged(object sender, TextChangedEventArgs e)
        {
            Control control = sender as Control;

            CueBannerService.UpdateAdornerState(control);
        }
Beispiel #4
0
        /// <summary>
        /// Event handler that updates the cue banner when the control gets focus.
        /// </summary>
        /// <param name="sender">The object where the event handler is attached.</param>
        /// <param name="e">The event data.</param>
        private static void Control_GotFocus(object sender, RoutedEventArgs e)
        {
            Control control = sender as Control;

            CueBannerService.UpdateAdornerState(control);
        }