AutoSaveToSource Property
AutoSaveToSource
Gets or sets a boolean value indicating whether designer should automatically translate changes to the source upon every change.
Declaration
public bool AutoSaveToSource { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Implements
Remarks
When this property value is false, the changes need to be written to the underlying source using the Save method.
Examples
Here is how to use a AutoSaveToSource in the C# code:
using System;
public partial class MainWindow : Window
{
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var formDesigner = new Alternet.FormDesigner.Wpf.FormDesignerControl();
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 System
Partial Public Class MainWindow
Inherits Window
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim formDesigner = New Alternet.FormDesigner.Wpf.FormDesignerControl()
formDesigner.AutoSaveToSource = False
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