menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class FitOptions - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class FitOptions

    Represents the configuration options for fitting the SfDiagramComponent into the viewport.

    Inheritance
    System.Object
    FitOptions
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class FitOptions : Object
    Remarks

    The FitOptions class provides settings to control how the diagram content is scaled and positioned within the available viewport area.

    Examples

    This example demonstrates how to use FitOptions to fit a diagram to the page.

    <SfDiagramComponent Width="1000px" Height="1000px">
    </SfDiagramComponent>
    @code
    {
       SfDiagramComponent Diagram;
       FitOptions Options = new FitOptions(){
       Mode = FitMode.Both,
       Region = DiagramRegion.PageSetting,
       }
       Diagram.FitToPage(Options);
    }

    Constructors

    FitOptions()

    Declaration
    public FitOptions()

    Properties

    CanZoomIn

    Gets or sets a value indicating whether the small diagram can be zoomed in to fit within the viewport.

    Declaration
    public bool CanZoomIn { get; set; }
    Property Value
    Type Description
    System.Boolean

    A System.Boolean indicating whether zooming in is allowed for small diagrams during fit operations. The default value is false.

    Remarks

    When the FitToPage method is called with the value of this property set to true, the zoom factor is increased to fit the entire diagram within the current viewport

    Examples
    <SfDiagramComponent Width="1000px" Height="1000px">
    </SfDiagramComponent>
    @code
    {
       SfDiagramComponent Diagram;
       FitOptions Options = new FitOptions(){
       Mode = FitMode.Both,
       Region = DiagramRegion.PageSetting,
       CanZoom=true
       }
       Diagram.FitToPage(Options);
    }

    Mode

    Gets or sets the mode of the fit options for the SfDiagramComponent.

    Declaration
    public FitMode Mode { get; set; }
    Property Value
    Type Description
    FitMode

    A FitMode specifying how the diagram content should be fitted within the viewport. The default value is Both.

    Remarks

    The mode determines how the diagram content is scaled and positioned within the viewport, with options to fit both dimensions, width only, or height only.

    Examples

    Demonstrates how to configure fit options with different modes for the diagram component.

    <SfDiagramComponent Width="1000px" Height="1000px">
    </SfDiagramComponent>
    @code
    {
       SfDiagramComponent Diagram;
       FitOptions Options = new FitOptions(){
       Mode = FitMode.Both,
       Region = DiagramRegion.PageSetting,
       }
       Diagram.FitToPage(Options);
    }

    Region

    Gets or sets the region in the SfDiagramComponent which needs to be fit within the viewport.

    Declaration
    public DiagramRegion Region { get; set; }
    Property Value
    Type Description
    DiagramRegion

    A DiagramRegion specifying the area to be fitted within the viewport. The default value is PageSettings.

    Remarks

    PageSettings fits the region within the specified page settings boundaries, while Content fits only the actual diagram content.

    Examples

    This example demonstrates how to use the Region property with FitToPage functionality.

    <SfDiagramComponent Width="1000px" Height="1000px">
    </SfDiagramComponent>
    @code
    {
       SfDiagramComponent Diagram;
       FitOptions Options = new FitOptions(){
       Mode = FitMode.Both,
       Region = DiagramRegion.PageSettings,
       }
       Diagram.FitToPage(Options);
    }
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved