TemplateBinding and optional string in Silverlight

In my Silverlight 3 application, I created a custom tooltip that displays when the mouse is over the Pie-Chart part. Displayed values ​​are set using TemplateBinding:

<ToolTipService.ToolTip>
  <StackPanel>
    <ContentControl Content="{TemplateBinding IndependentValue}" FontWeight="Bold" />
    <ContentControl Content="{TemplateBinding FormattedDependentValue}"/>
    <ContentControl Content="{TemplateBinding FormattedRatio}"/>
  </StackPanel>
</ToolTipService.ToolTip>

The tooltip displays the name of the slice of the pie, the value on which the size of the slice is based, and the percentage for the whole pie:

Mytitel

9

12%

Now I want to add a constant to the value to show the following:

Mytitel

9 points

12%

the string "items" is added to the displayed number. Is there a way to add a constant string to the Content-Property ContentControl? (I do not affect the bound value of FormattedDependentValue)

Thanks in advance, Frank

+3
1

, Silverlight StringFormat . :

  • StackPanel , TextBlock "". 100% , , .

  • . Convert "Items". -, StringFormat. .

+2

Source: https://habr.com/ru/post/1737144/


All Articles