# C1.PivotEngine.C1PivotEngine.ViewDefinition

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_PivotEngine_C1PivotEngine_ViewDefinition_" data-uid="C1.PivotEngine.C1PivotEngine.ViewDefinition*">ViewDefinition Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_PivotEngine_C1PivotEngine_ViewDefinition_" data-uid="C1.PivotEngine.C1PivotEngine.ViewDefinition*"></a>
<h4 id="C1_PivotEngine_C1PivotEngine_ViewDefinition" data-uid="C1.PivotEngine.C1PivotEngine.ViewDefinition">ViewDefinition</h4>
<div class="markdown level1 summary"><p>Gets or sets the PivotEngine view definition as an XML string.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public string ViewDefinition { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Property ViewDefinition As String</code></pre>
</div>
<h5 id="C1_PivotEngine_C1PivotEngine_ViewDefinition_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This property is typically used to persist the current PivotEngine
view as an application setting.</p>
</div>
<h5 id="C1_PivotEngine_C1PivotEngine_ViewDefinition_examples">Examples</h5>
<p>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.</p>
<p>The code assumes that the application settings contain a 
string property called "PivotEngineView".</p>
<pre><code class="lang-csharp">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();
}</code></pre>

</div>
