Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ToolTipExtension.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Windows.Markup;
5 
6 namespace SiliconStudio.Presentation.MarkupExtensions
7 {
8  /// <summary>
9  /// This markup extension allows to format the text of a tooltip a text and a gesture.
10  /// </summary>
12  {
13  private readonly string content;
14 
15  /// <summary>
16  /// Initializes a new instance of the <see cref="ToolTipExtension"/> class.
17  /// </summary>
18  /// <param name="text">A string representing the tooltip text</param>
19  /// <param name="gesture">A string representing the gesture.</param>
20  public ToolTipExtension(string text, string gesture)
21  {
22  content = !string.IsNullOrEmpty(gesture) ? string.Format("{0} ({1})", text, gesture) : text;
23  }
24 
25  /// <inheritdoc/>
26  public override object ProvideValue(IServiceProvider serviceProvider)
27  {
28  return content;
29  }
30  }
31 }
override object ProvideValue(IServiceProvider serviceProvider)
ToolTipExtension(string text, string gesture)
Initializes a new instance of the ToolTipExtension class.
This markup extension allows to format the text of a tooltip a text and a gesture.