Blazor

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SizingOptions - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SizingOptions

    Specifies to equally size the selected nodes with respect to the first selected object.

    Inheritance
    System.Object
    SizingOptions
    Namespace: Syncfusion.Blazor.Diagrams
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public sealed class SizingOptions : Enum
    Remarks
    To know more about using the SizingOptions, refer to this link
    1. Commands
    2. Diagram Methods
    To apply the sizing options, use the below code.
    Examples
    <input type="button" value="Same Width" @onclick="@OnSameWidth" />
    <input type = "button" value="Same Height" @onclick="@OnSameHeight" />
    <input type = "button" value="Same Size" @onclick="@OnSameSize" />
    <SfDiagram @ref = "@Diagram" Height="600px" Nodes="@NodeCollection">
    </SfDiagram>
    @code{
       SfDiagram Diagram;
       public ObservableCollection<DiagramNode> NodeCollection;
       protected override void OnInitialized()
       {
           // A node is created and stored in the node's collection.
           NodeCollection = new ObservableCollection<DiagramNode>(){
               new DiagramNode()
               {
                   Id = "Node1",
                   // Position of the node
                   OffsetX = 100, OffsetY = 100,
                   // Size of the node
                   Width = 70, Height = 40,
                   Style = new NodeShapeStyle() { Fill = "#6BA5D7", StrokeColor = "white" }
               },
               new DiagramNode()
               {
                   Id = "Node2",
                   // Position of the node
                   OffsetX = 100, OffsetY = 300,
                   // Size of the node
                   Width = 60, Height = 80,
                   Style = new NodeShapeStyle() { Fill = "#6BA5D7", StrokeColor = "white" }
               },
                new DiagramNode()
               {
                   Id = "Node3",
                   // Position of the node
                   OffsetX = 100, OffsetY = 200,
                   // Size of the node
                   Width = 50, Height = 50,
                   Style = new NodeShapeStyle() { Fill = "#6BA5D7", StrokeColor = "white" }
               },
               new DiagramNode()
               {
                   Id = "Node4",
                   // Position of the node
                   OffsetX = 200, OffsetY = 250,
                   // Size of the node
                   Width = 70, Height = 90,
                   Style = new NodeShapeStyle() { Fill = "#6BA5D7", StrokeColor = "white" }
               }
           };
       }
       // Same width
       public async void OnSameWidth()
       {
           Diagram.Select(new ObservableCollection<DiagramNode>() { Diagram.Nodes[0], Diagram.Nodes[1], Diagram.Nodes[2] }, true);
           SizingOptions SizingOptions = SizingOptions.Width;
           Diagram.SameSize(SizingOptions);
       }
       // Same Height
       public async void OnSameHeight()
       {
           Diagram.Select(new ObservableCollection<DiagramNode>() { Diagram.Nodes[0], Diagram.Nodes[1], Diagram.Nodes[2] }, true);
           //Changing the selected nodes to same height
           SizingOptions SizingOptions = SizingOptions.Height;
           Diagram.SameSize(SizingOptions);
       }
       // Same Height
       public async void OnSameSize()
       {
           Diagram.SelectAll();
           //Changing the selected nodes to same size
           SizingOptions SizingOptions = SizingOptions.Size;
           Diagram.SameSize(SizingOptions);
       }
    }

    Fields

    Height

    Scales the height of the selected objects.

    Declaration
    public const SizingOptions Height
    Field Value
    Type Description
    SizingOptions

    Size

    Scales the selected objects both vertically and horizontally.

    Declaration
    public const SizingOptions Size
    Field Value
    Type Description
    SizingOptions

    value__

    Declaration
    public int value__
    Field Value
    Type Description
    System.Int32

    Width

    Scales the width of the selected objects.

    Declaration
    public const SizingOptions Width
    Field Value
    Type Description
    SizingOptions
    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved