35
35
36
36
namespace Xamarin . Forms . Xaml
37
37
{
38
- internal static class XamlLoader
38
+ public static class XamlLoader
39
39
{
40
40
static readonly Dictionary < Type , string > XamlResources = new Dictionary < Type , string > ( ) ;
41
41
@@ -49,7 +49,12 @@ public static void Load(BindableObject view, Type callingType)
49
49
50
50
public static void Load ( BindableObject view , string xaml )
51
51
{
52
- using ( var reader = XmlReader . Create ( new StringReader ( xaml ) ) )
52
+ Load ( view , new StringReader ( xaml ) ) ;
53
+ }
54
+
55
+ public static void Load ( BindableObject view , TextReader textReader )
56
+ {
57
+ using ( var reader = XmlReader . Create ( textReader ) )
53
58
{
54
59
while ( reader . Read ( ) )
55
60
{
@@ -71,9 +76,14 @@ public static void Load(BindableObject view, string xaml)
71
76
}
72
77
73
78
public static object Create ( string xaml , bool doNotThrow = false )
79
+ {
80
+ return Create ( new StringReader ( xaml ) , doNotThrow ) ;
81
+ }
82
+
83
+ public static object Create ( TextReader textReader , bool doNotThrow = false )
74
84
{
75
85
object inflatedView = null ;
76
- using ( var reader = XmlReader . Create ( new StringReader ( xaml ) ) ) {
86
+ using ( var reader = XmlReader . Create ( textReader ) ) {
77
87
while ( reader . Read ( ) ) {
78
88
//Skip until element
79
89
if ( reader . NodeType == XmlNodeType . Whitespace )
@@ -225,7 +235,7 @@ static string ReadResourceAsXaml(Type type, Assembly assembly, string likelyTarg
225
235
return null ;
226
236
}
227
237
228
- public class RuntimeRootNode : RootNode
238
+ internal class RuntimeRootNode : RootNode
229
239
{
230
240
public RuntimeRootNode ( XmlType xmlType , object root , IXmlNamespaceResolver resolver ) : base ( xmlType , resolver )
231
241
{
0 commit comments