Permalink
Browse files

XamlLoader is now public-facing

XamlLoader is public instead of internal
Added overloads to pass a TextReader instead of string
  • Loading branch information...
Jonathan Peppers
Jonathan Peppers committed Jun 16, 2016
1 parent 8d11b1d commit b0cc6cee69f4d10559fdd590ae3e35f3753de467
Showing with 14 additions and 4 deletions.
  1. +14 −4 Xamarin.Forms.Xaml/XamlLoader.cs
@@ -35,7 +35,7 @@
namespace Xamarin.Forms.Xaml
{
internal static class XamlLoader
public static class XamlLoader
{
static readonly Dictionary<Type, string> XamlResources = new Dictionary<Type, string>();
@@ -49,7 +49,12 @@ public static void Load(BindableObject view, Type callingType)
public static void Load(BindableObject view, string xaml)
{
using (var reader = XmlReader.Create(new StringReader(xaml)))
Load(view, new StringReader(xaml));
}
public static void Load(BindableObject view, TextReader textReader)
{
using (var reader = XmlReader.Create(textReader))
{
while (reader.Read())
{
@@ -71,9 +76,14 @@ public static void Load(BindableObject view, string xaml)
}
public static object Create (string xaml, bool doNotThrow = false)
{
return Create (new StringReader(xaml), doNotThrow);
}
public static object Create (TextReader textReader, bool doNotThrow = false)
{
object inflatedView = null;
using (var reader = XmlReader.Create (new StringReader (xaml))) {
using (var reader = XmlReader.Create (textReader)) {
while (reader.Read ()) {
//Skip until element
if (reader.NodeType == XmlNodeType.Whitespace)
@@ -225,7 +235,7 @@ static string ReadResourceAsXaml(Type type, Assembly assembly, string likelyTarg
return null;
}
public class RuntimeRootNode : RootNode
internal class RuntimeRootNode : RootNode
{
public RuntimeRootNode(XmlType xmlType, object root, IXmlNamespaceResolver resolver) : base (xmlType, resolver)
{

0 comments on commit b0cc6ce

Please sign in to comment.