XamlReader

public static class XamlReader
Methods to help load/save Eto objects to/from xaml

Fields

DesignNamespace

#Since v2.13
public static readonly string DesignNamespace
Xaml Namespace for designer-only attributes such as d:DataContext, only applied when Control.IsDesignMode is true

EtoFormsNamespace

#
public static readonly string EtoFormsNamespace
Xaml Namespace for Eto.Forms elements

Properties

DesignMode

#
public static bool DesignMode { get; set; }
Gets or sets a value indicating that the reader is used in design mode
Remarks: In Design mode, events are not wired up and will not cause exceptions due to missing methods to wire up to.

Methods

Load<T>

#
public static T Load<T>()
Loads the specified type from a xaml of the same name
Remarks: If your class name is MyNamespace.MyType, then this will attempt to load MyNamespace.MyType.xaml for the xaml definition in the same assembly. If you want to specify a different xaml, use Load<T>(Stream)
A new instance of the specified type with the contents loaded from xaml

Load<T>

#Since v2.10
public static T Load<T>(Stream stream, T instance, XamlReaderSettings settings)

Load<T>

#
public static T Load<T>(Stream stream, T instance)
Loads the specified type from the specified xaml stream
stream (Stream)Xaml content to load (e.g. from resources)
instance (T)Instance to use as the starting object, or null to create a new instance
A new or existing instance of the specified type with the contents loaded from the xaml stream

Load<T>

#
public static T Load<T>(Stream stream)
Loads the specified type from the specified xaml stream
Remarks: If your class name is MyNamespace.MyType, then this will attempt to load MyNamespace.MyType.xaml for the xaml definition in the same assembly.
stream (Stream)Xaml content to load (e.g. from resources)
A new instance of the specified type with the contents loaded from the xaml stream

Load<T>

#
public static T Load<T>(TextReader reader, T instance)
Loads the specified type from the specified text reader.
reader (TextReader)Reader to read the Xaml content
instance (T)Instance to use as the starting object, or null to create a new instance
A new or existing instance of the specified type with the contents loaded from the xaml stream

Load<T>

#
public static T Load<T>(XmlReader reader, T instance)
Loads the specified type from the specified XML reader.
reader (XmlReader)XmlReader to read the Xaml content
instance (T)Instance to use as the starting object, or null to create a new instance
A new or existing instance of the specified type with the contents loaded from the xaml stream

Load<T>

#
public static void Load<T>(T instance, string resourceName)
Loads the specified instance with a specified fully qualified xaml embedded resource
Remarks: This will load the embedded resource from the same assembly as instance with the specified resourceName embedded resource. If you want to specify a different xaml, use Load<T>(Stream, T)
instance (T)Instance to use as the starting object
resourceName (string)Fully qualified name of the embedded resource to load.
An existing instance of the specified type with the contents loaded from the xaml stream

Load<T>

#
public static void Load<T>(T instance)
Loads the specified instance with xaml of the same name
Remarks: If your class name is MyNamespace.MyType, then this will attempt to load MyNamespace.MyType.xaml for the xaml definition in the same assembly. If you want to specify a different xaml, use Load<T>(Stream, T)
instance (T)Instance to use as the starting object
A new or existing instance of the specified type with the contents loaded from the xaml stream

Watch<T>

#Since v2.10
public static bool Watch<T>(T control, string fileName = null, string sourcePath = null)
Watches the .xeto file for changes and triggers the method specified by the HotReloadAttribute, if any, when the file changes. Otherwise, it will reload the xeto into the control using Load<T>().
control (T)Instance of the control to watch for changes
fileName (string = null)Name of the file to watch, or null to use the default based on the class name
sourcePath (string = null)Source path of the file to watch
true if the file is being watched, false otherwise