Property AutoSaveToSource
- Namespace
- Alternet.FormDesigner.WinForms
- Assembly
- Alternet.FormDesigner.v9.dll
AutoSaveToSource
Gets or sets a boolean value indicating whether designer should automatically translate changes to the source upon every change.
public bool AutoSaveToSource { get; set; }
Property Value
Examples
Here is how to use a AutoSaveToSource in the C# code:
using Alternet.FormDesigner.WinForms;
using System;
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
var formDesigner = new FormDesignerControl();
formDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
formDesigner.Parent = this;
formDesigner.AutoSaveToSource = false;
formDesigner.DesignedContentChanged += Designer_DesignedContentChanged;
}
private void Designer_DesignedContentChanged(object sender, EventArgs e)
{
var designer = sender as FormDesignerControl;
if (designer != null)
{
designer.Save();
}
}
}
Here is how to use a AutoSaveToSource in the Visual Basic code:
Imports Alternet.FormDesigner.WinForms
Imports System
Partial Public Class Form1
Inherits Form
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim formDesigner = New FormDesignerControl()
formDesigner.Dock = System.Windows.Forms.DockStyle.Fill
formDesigner.Parent = Me
formDesigner.AutoSaveToSource = False
AddHandler formDesigner.DesignedContentChanged, AddressOf Designer_DesignedContentChanged
End Sub
Private Sub Designer_DesignedContentChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim designer = TryCast(sender, FormDesignerControl)
If designer IsNot Nothing Then
designer.Save()
End If
End Sub
End Class
Remarks
When this property value is false, the changes need to be written to the underlying source using the Save method.