FlexPivot for WPF | ComponentOne
C1.PivotEngine Assembly / C1.PivotEngine Namespace / C1PivotEngine Class / ViewDefinition Property
Example

In This Topic
    ViewDefinition Property (C1PivotEngine)
    In This Topic
    Gets or sets the PivotEngine view definition as an XML string.
    Syntax
    'Declaration
     
    Public Property ViewDefinition As String
    public string ViewDefinition {get; set;}
    Remarks
    This property is typically used to persist the current PivotEngine view as an application setting.
    Example

    The code below shows how to save a PivotEngine view as an application setting when the application ends and how to load it when the application starts.

    The code assumes that the application settings contain a string property called "PivotEngineView".

    public Form1()
    {
      InitializeComponent();
                
      // load default view
      C1PivotEngine fp = GetPivotEngine();
      string view = Properties.Settings.Default.PivotEngineView;
      if (!string.IsNullOrEmpty(view))
      {
        fp.ViewDefinition = Properties.Settings.Default.PivotEngineView;
      }
    }
    protected override void OnClosed(EventArgs e)
    {
      // save current view as default
      C1PivotEngine fp = GetPivotEngine();
      Properties.Settings.Default.PivotView = fp.ViewDefinition;
      Properties.Settings.Default.Save();
    }
    See Also