diff --git a/.gitmodules b/.gitmodules
index bdd5d5ca4d..6e9b10efa4 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,4 +7,4 @@
branch = perspex-pcl
[submodule "src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github"]
path = src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github
- url = https://github.com/cwensley/Portable.Xaml.git
+ url = https://github.com/AvaloniaUI/Portable.Xaml.git
diff --git a/build/Markup.props b/build/Markup.props
index 0e4baf5da9..5be0cfbf0c 100644
--- a/build/Markup.props
+++ b/build/Markup.props
@@ -9,5 +9,6 @@
+
diff --git a/packages.cake b/packages.cake
index 5f268188dc..1f37461da7 100644
--- a/packages.cake
+++ b/packages.cake
@@ -248,7 +248,7 @@ public class Packages
}
.Deps(new string[]{null, "netcoreapp1.0"},
"System.ValueTuple", "System.ComponentModel.TypeConverter", "System.ComponentModel.Primitives",
- "System.Runtime.Serialization.Primitives", "System.Xml.XmlDocument")
+ "System.Runtime.Serialization.Primitives", "System.Xml.XmlDocument", "System.Xml.ReaderWriter")
.ToArray(),
Files = coreLibrariesNuSpecContent
.Concat(win32CoreLibrariesNuSpecContent).Concat(net45RuntimePlatform)
diff --git a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs
index c49797f2f8..0419db5d0f 100644
--- a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs
@@ -189,7 +189,7 @@ namespace Avalonia.Markup.Xaml
context);
XamlServices.Transform(reader, writer);
-
+ writer.ApplyAllDelayedProperties();
return writer.Result;
}
diff --git a/src/Markup/Avalonia.Markup.Xaml/Converters/SetterValueTypeConverter.cs b/src/Markup/Avalonia.Markup.Xaml/Converters/SetterValueTypeConverter.cs
index 931d4e2ffc..81cda6db1f 100644
--- a/src/Markup/Avalonia.Markup.Xaml/Converters/SetterValueTypeConverter.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/Converters/SetterValueTypeConverter.cs
@@ -23,11 +23,11 @@ namespace Avalonia.Markup.Xaml.Converters
object setter = context.GetService().TargetObject;
var schemaContext = context.GetService().SchemaContext;
- return ConvertSetterValue(schemaContext, (setter as Setter), value);
+ return ConvertSetterValue(context, schemaContext, culture, (setter as Setter), value);
}
[Obsolete("TODO: try assosiate Setter.Value property with SetterValueTypeConverter, so far coouldn't make it :(")]
- internal static object ConvertSetterValue(XamlSchemaContext context, Setter setter, object value)
+ internal static object ConvertSetterValue(ITypeDescriptorContext dcontext, XamlSchemaContext context, CultureInfo info, Setter setter, object value)
{
Type targetType = setter?.Property?.PropertyType;
@@ -40,7 +40,7 @@ namespace Avalonia.Markup.Xaml.Converters
if (ttConv != null)
{
- value = ttConv.ConvertFromString(value as string);
+ value = ttConv.ConvertFromString(dcontext, info, value as string);
}
return value;
diff --git a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlObjectWriter.cs b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlObjectWriter.cs
index f10de1a32f..e0e2553f46 100644
--- a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlObjectWriter.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlObjectWriter.cs
@@ -54,6 +54,12 @@ namespace Avalonia.Markup.Xaml.PortableXaml
base.Dispose(disposing);
}
+ public void ApplyAllDelayedProperties()
+ {
+ //HACK: We need this because Begin/EndInit ordering is broken
+ _delayedValuesHelper.ApplyAll();
+ }
+
protected internal override void OnAfterBeginInit(object value)
{
//not called for avalonia objects
@@ -88,8 +94,8 @@ namespace Avalonia.Markup.Xaml.PortableXaml
//Portable.Xaml.ComponentModel.ISupportInitialize
//and we have Avalonia.ISupportInitialize so we need some hacks
HandleBeginInit(value);
-
- _delayedValuesHelper.BeginInit(value);
+ if (value != null)
+ _delayedValuesHelper.BeginInit(value);
base.OnBeforeProperties(value);
}
@@ -137,7 +143,7 @@ namespace Avalonia.Markup.Xaml.PortableXaml
if (_cnt == 0)
{
- EndInit();
+ ApplyAll();
}
}
@@ -174,7 +180,7 @@ namespace Avalonia.Markup.Xaml.PortableXaml
}
}
- private void EndInit()
+ public void ApplyAll()
{
//TODO: revisit this
//apply delayed values and clear
diff --git a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlType.cs b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlType.cs
index 8fcde185b3..71c8902cbd 100644
--- a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlType.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlType.cs
@@ -8,6 +8,7 @@ using Portable.Xaml.Schema;
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Globalization;
using System.Reflection;
using System.Xml.Serialization;
@@ -203,8 +204,8 @@ namespace Avalonia.Markup.Xaml.PortableXaml
Member.Name == nameof(Setter.Value) &&
value is string)
{
- value = SetterValueTypeConverter.ConvertSetterValue(
- Member.DeclaringType.SchemaContext,
+ value = SetterValueTypeConverter.ConvertSetterValue(null,
+ Member.DeclaringType.SchemaContext, CultureInfo.InvariantCulture,
instance as Setter,
value);
}
@@ -331,7 +332,7 @@ namespace Avalonia.Markup.Xaml.PortableXaml
public override object GetValue(object instance)
{
- if (Property != null)
+ if (Property != null && !Property.IsAttached)
{
return ((IAvaloniaObject)instance).GetValue(Property);
}
diff --git a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github
index d50730ab59..dfc5affa5d 160000
--- a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github
+++ b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github
@@ -1 +1 @@
-Subproject commit d50730ab59aed99cd2f8aeb4975fcc19d23bb54f
+Subproject commit dfc5affa5d8f4ddf5a7707e3202d5593519de640