示例#1
0
文件: Info.cs 项目: ewelike23/jmm
        /// <summary>
        /// Performs a lookup for the defined <see cref="Title"/> and
        /// <see cref="Info"/> and creates the tooltip control.
        /// </summary>
        /// <returns>
        /// A <see cref="ToolTip"/> that contains the
        /// <see cref="InfoPopup"/> control.
        /// </returns>
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            //create the user control that
            InfoPopup popup = new InfoPopup();


            if (!String.IsNullOrEmpty(Title))
            {
                //look up title - if the string is not a
                //resource key, use it directly
                var result = Resources.ResourceManager.GetObject(Title) ?? Title;
                popup.HeaderText = (string)result;
            }

            if (!String.IsNullOrEmpty(Body))
            {
                //look up body text - if the string is not a
                //resource key, use it directly
                var result = Resources.ResourceManager.GetObject(Body) ?? Body;
                popup.BodyText = (string)result;
            }

            //create tooltip and make sure it's not visible
            ToolTip tt = new ToolTip();

            tt.HasDropShadow   = false;
            tt.BorderThickness = new Thickness(0);
            tt.Background      = Brushes.Transparent;
            tt.Content         = popup;

            return(tt);
        }
示例#2
0
文件: Info.cs 项目: dizzydezz/jmm
		/// <summary>
		/// Performs a lookup for the defined <see cref="Title"/> and
		/// <see cref="Info"/> and creates the tooltip control.
		/// </summary>
		/// <returns>
		/// A <see cref="ToolTip"/> that contains the
		/// <see cref="InfoPopup"/> control.
		/// </returns>
		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			//create the user control that 
			InfoPopup popup = new InfoPopup();


			if (!String.IsNullOrEmpty(Title))
			{
				//look up title - if the string is not a
				//resource key, use it directly
				var result = Resources.ResourceManager.GetObject(Title) ?? Title;
				popup.HeaderText = (string)result;
			}

			if (!String.IsNullOrEmpty(Body))
			{
				//look up body text - if the string is not a
				//resource key, use it directly
				var result = Resources.ResourceManager.GetObject(Body) ?? Body;
				popup.BodyText = (string)result;
			}

			//create tooltip and make sure it's not visible
			ToolTip tt = new ToolTip();
			tt.HasDropShadow = false;
			tt.BorderThickness = new Thickness(0);
			tt.Background = Brushes.Transparent;
			tt.Content = popup;

			return tt;
		}
示例#3
0
        /// <summary>
        /// A static callback listener which is being invoked if the
        /// <see cref="HeaderTextProperty"/> dependency property has
        /// been changed. Invokes the <see cref="OnHeaderTextPropertyChanged"/>
        /// instance method of the changed instance.
        /// </summary>
        /// <param name="d">The currently processed owner of the property.</param>
        /// <param name="e">Provides information about the updated property.</param>
        private static void HeaderTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            InfoPopup owner = (InfoPopup)d;

            owner.OnHeaderTextPropertyChanged(e);
        }