We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set a StringFormat in a textblock inside the AdornmentInfo?

I tried some alternatives, any works.
No works: Text="{Binding StringFormat={}{0:C}}"
No works: Text="{Binding StringFormat=${0:C}}"
No works: Text="{Binding Path=SomeNumber, ConverterCulture='en-US', StringFormat={} {0:C}}"
No works: Text="{Binding Path=Number, StringFormat={} {0:##.0}}"

I want to show this number: 300000000 in $300,000,000 in the adornmentInfo.

Thanks for help.

5 Replies

SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team May 12, 2016 11:54 AM UTC

Hi Tomas,

Thanks for contacting Syncfusion Support.

For applying required format, we need to apply the string format as like in the below code example. 
Code Snippet: 
[XAML] 
<DataTemplate x:Key="TextTemplate"> 
     <TextBlock Background="Red" Text="{Binding YData,StringFormat=C0}" Padding="5"/> 
</DataTemplate> 
 
  
Demo sample: Column
 
  
For more information about the adornments, please refer the below documentation link. 



TR Tomas Raziel Garza Amaya May 12, 2016 03:17 PM UTC

Thanks, its works


SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team May 13, 2016 04:45 AM UTC

Hi Tomas,

We are glad that your requirement has been met.

Please let us know if you have any queries.

Regards,
Samuel


FE fernando replied to Samuel Rajadurai Edwin Rajamanickam September 22, 2016 11:58 PM UTC

Hi Tomas,

We are glad that your requirement has been met.

Please let us know if you have any queries.

Regards,
Samuel

Hi  
can you help me?
as I can assign a specific value to a textblock, I'm using Diagramming of Syncfusion, but in the draft DiagramBuilder cannot assign a special value.
I am using wpf.
I teach them the code.

 <!--Número de Escenario de Etiqueta-->
    <DataTemplate x:Key="ndede">
        <Viewbox Stretch="Fill">
            <Grid>
                <TextBlock Text="Número de Escenario de Etiqueta"></TextBlock>
                     </Grid>
        </Viewbox>
    </DataTemplate>


the name of the class is DiagramBuilderUI.xaml


Attachment: error_d7834f61.rar


KR Keerthivasan Ramamoorthy Syncfusion Team September 23, 2016 08:55 AM UTC

Hi Fernando, 
 
Requirement:” Need to Add text and change this text according to different SymbolItems”. 
 
We have analyzed and achieved your requirement in DiagramBuilder. Please refer the code example as below. 
 
Code Example: 
 
Add your text into Content Property of the NodeViewModel. 
 
<syncfusion:NodeViewModel Key="Basic Shapes" Content="Número de Escenario de Etiqueta" UnitHeight="50" UnitWidth="50" OffsetX="100" OffsetY="100" Shape="{StaticResource Rectangle}" ShapeStyle="{StaticResource SymbolStyle}"></syncfusion:NodeViewModel> 
 
Add ContentTemplate Property inside the NodeView Style.  
<Style TargetType="{x:Type view:NodeView}" BasedOn="{StaticResource NodeBindingStyle}"> 
        <Setter Property="Background" Value="Transparent"/> 
        <Setter Property="ContentTemplate"> 
            <Setter.Value> 
                <DataTemplate> 
                    <Viewbox Stretch="Fill"> 
                        <Grid> 
                            <TextBlock Text="{Binding}"></TextBlock> 
                        </Grid> 
                    </Viewbox> 
                </DataTemplate>             
 
            </Setter.Value> 
        </Setter> 
 
 
In NodeVM.CS class, remove the Content= null from the ContentDummy Property. 
[DataMember] 
        public string ContentDummy 
        { 
            get { return _content; } 
            set 
            { 
                _content = value; 
                Shape = value; //Clone(value); 
                Content = null; 
            } 
        } 
 
 
Explanation: 
We have used ContentTemplate Property to Display the Content of the NodeViewModel. 
 
Note: 
If the provided information not meet your requirement, please provide more details like sample/video to represent your requirement. This helps us to provide a prompt solution at the earliest. 
 
 
 
Regards, 
Keerthivasan R. 


Loader.
Live Chat Icon For mobile
Up arrow icon