Class DiagramTextStyle
Represents the text style for an object.
Inheritance
Namespace: Syncfusion.Blazor.Diagrams
Assembly: Syncfusion.Blazor.dll
Syntax
public class DiagramTextStyle : SfDiagramBase
Examples
<SfDiagram Height="600px" Nodes="@NodeCollection">
</SfDiagram>
@code
{
//Defines diagram's node collection
public ObservableCollection<DiagramNode> NodeCollection { get; set; }
SnapConstraints snapConstraints;
protected override void OnInitialized()
{
snapConstraints = SnapConstraints.None;
NodeCollection = new ObservableCollection<DiagramNode>();
DiagramNode Node = new DiagramNode()
{
Id = "node1",
Width = 100,
Height = 100,
OffsetX = 100,
OffsetY = 100,
// Sets the annotation for the node
Annotations = new ObservableCollection<DiagramNodeAnnotation>() {
new DiagramNodeAnnotation() {Content = "Annotation Text",Style = new AnnotationStyle() {Color="black",Bold = true,Italic = true,TextDecoration=TextDecoration.Underline,FontSize = 12,FontFamily = "TimesNewRoman" } }
},
Style = new NodeShapeStyle() { Fill = "#6BA5D7", StrokeColor = "white" },
};
NodeCollection.Add(Node);
}
}
Constructors
DiagramTextStyle()
Represents the text style for an object.
Declaration
public DiagramTextStyle()
Properties
Bold
Specifies whether a font appears in bold or not. By default, it`s false.
Declaration
public bool Bold { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Color
Specifies the font color of a text. By default, it`s black.
Declaration
public string Color { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Fill
Sets the fill color of a shape/path. By default, it`s transparent.
Declaration
public string Fill { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FontFamily
Specifies the font type of a text. By default, it`s Arial.
Declaration
public string FontFamily { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FontSize
Specifies the font size of a text. By default, it`s 12.
Declaration
public double FontSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Gradient
This property allows the users to define and apply the gradient effect to the text.
Declaration
public DiagramGradient Gradient { get; set; }
Property Value
Type | Description |
---|---|
DiagramGradient |
Italic
Enables/disables the italic style of a text. By default, it`s false.
Declaration
public bool Italic { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Opacity
Specifies the transparency level of the text. By default, it`s 1.
Declaration
public double Opacity { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
Opacity values are ranges from 0 to 1 are as follow as, |
• 0- completely transparent |
• 0.5- Partially transparent |
• 1- not transparent at all. |
StrokeColor
Gets or sets the stroke color of a text. By default, it`s black.
Declaration
public string StrokeColor { get; set; }
Property Value
Type | Description |
---|---|
System.String |
StrokeDashArray
Specifies the patterns of dashes and spaces to stroke the text.
Declaration
public string StrokeDashArray { get; set; }
Property Value
Type | Description |
---|---|
System.String |
StrokeWidth
Specifies the stroke width of the text. By default, it`s 1.
Declaration
public double StrokeWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
TextAlign
Specifies how they should be aligned within its bounds. By default, it`s set to Center.
Declaration
public TextAlign TextAlign { get; set; }
Property Value
Type | Description |
---|---|
TextAlign |
TextDecoration
Specifies how the text should be decorated.
Declaration
public TextDecoration TextDecoration { get; set; }
Property Value
Type | Description |
---|---|
TextDecoration |
TextOverflow
Specifies how to handle the text when it exceeds the given size. By default, it`s set to Wrap.
Declaration
public TextOverflow TextOverflow { get; set; }
Property Value
Type | Description |
---|---|
TextOverflow |
TextWrapping
Specifies how the text should be wrapped when the text size exceeds some specific bounds. By default, it`s set to WrapWithOverflow.
Declaration
public TextWrap TextWrapping { get; set; }
Property Value
Type | Description |
---|---|
TextWrap |
WhiteSpace
Specifies how to white space and new line characters must be handled. By default, it`s set to CollapseSpace.
Declaration
public WhiteSpace WhiteSpace { get; set; }
Property Value
Type | Description |
---|---|
WhiteSpace |