示例#1
0
        //helper method to add the prompt
        private static void AddPromptAdorner(UIElement element, string text)
        {
            AdornerLayer layer = AdornerLayer.GetAdornerLayer(element);

            if (layer != null)
            {
                //try to get the prompt adorner and if it is not there create it
                PromptAdorner adorner = GetPromptAdorner(element);
                if (adorner == null)
                {
                    adorner = new PromptAdorner(element, text);
                    SetPromptAdorner(element, adorner);
                }
                else
                {
                    adorner.ShowAdorner();
                }

                //if the adorner is not already there add it
                Adorner[] adorners = layer.GetAdorners(element);
                if (adorners == null)
                {
                    layer.Add(adorner);
                }
                else if (!adorners.Contains(adorner))
                {
                    layer.Add(adorner);
                }
            }
        }
        //helper method to add the prompt
        private static void AddPromptAdorner(UIElement element, string text)
        {
            AdornerLayer layer = AdornerLayer.GetAdornerLayer(element);
            if (layer != null)
            {
                //try to get the prompt adorner and if it is not there create it
                PromptAdorner adorner = GetPromptAdorner(element);
                if (adorner == null)
                {
                    adorner = new PromptAdorner(element, text);
                    SetPromptAdorner(element, adorner);
                }
                else
                {
                    adorner.ShowAdorner();
                }

                //if the adorner is not already there add it
                Adorner[] adorners = layer.GetAdorners(element);
                if (adorners == null)
                    layer.Add(adorner);
                else if (!adorners.Contains(adorner))
                    layer.Add(adorner);
            }
        }
示例#3
0
 /// <summary>
 /// Sets the prompt adorner
 /// </summary>
 /// <param name="obj">The element to set the adorner to</param>
 /// <param name="value">The adorner to set</param>
 internal static void SetPromptAdorner(DependencyObject obj, PromptAdorner value)
 {
     obj.SetValue(PromptAdornerProperty, value);
 }
 /// <summary>
 /// Sets the prompt adorner
 /// </summary>
 /// <param name="obj">The element to set the adorner to</param>
 /// <param name="value">The adorner to set</param>
 internal static void SetPromptAdorner(DependencyObject obj, PromptAdorner value)
 {
     obj.SetValue(PromptAdornerProperty, value);
 }