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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

124056 May 11,2016 04:44 PM Sep 23,2016 04:55 AM WPF 5
loading
Tags: SfDiagram
Tomas Raziel Garza Amaya
Asked On May 11, 2016 04:44 PM

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.

Samuel Rajadurai Edwin Rajamanickam [Syncfusion]
Replied On May 12, 2016 07:54 AM

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. 


Tomas Raziel Garza Amaya
Replied On May 12, 2016 11:17 AM

Thanks, its works

Samuel Rajadurai Edwin Rajamanickam [Syncfusion]
Replied On May 13, 2016 12:45 AM

Hi Tomas,

We are glad that your requirement has been met.

Please let us know if you have any queries.

Regards,
Samuel

fernando
Replied On September 22, 2016 07:58 PM

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

Keerthivasan Ramamoorthy [Syncfusion]
Replied On September 23, 2016 04:55 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;