Root Property
Root
Declaration
public IOutlineNode Root { get; set; }
Property Value
Type | Description |
---|---|
IOutlineNode |
Remarks
The Root property represents a root element in the form's layout.
Any time you associate a new FormDesigner with OutlineControl, it creates a root IOutlineNode item from the FormDesigner root element.
Examples
Here is how to use a Root in the C# code:
using System;
using System.Windows;
using Alternet.FormDesigner.Wpf;
using Alternet.FormDesigner.Wpf.Outline;
public partial class MainWindow : Window
{
private OutlineControl outlineControl = new OutlineControl();
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var formDesigner = new FormDesignerControl();
formDesigner.AutoSaveToSource = false;
formDesigner.DesignedContentChanged += Designer_DesignedContentChanged;
outlineControl.FormDesigner = formDesigner;
}
private void Designer_DesignedContentChanged(object sender, EventArgs e)
{
MessageBox.Show(outline.Root?.Name);
}
}
Here is how to use a Root in the Visual Basic code:
Imports System
Imports Alternet.FormDesigner.Wpf
Imports Alternet.FormDesigner.Wpf.Outline
Partial Public Class MainWindow
Inherits Window
Private outlineControl As OutlineControl = New OutlineControl()
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim formDesigner = New FormDesignerControl()
formDesigner.AutoSaveToSource = False
AddHandler formDesigner.DesignedContentChanged, AddressOf Designer_DesignedContentChanged
outlineControl.FormDesigner = formDesigner
End Sub
Private Sub Designer_DesignedContentChanged(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show(outline.Root?.Name)
End Sub
End Class