Browse Source

Merge branch 'master' into d2d-netstandard

pull/1040/head
Jeremy Koritzinsky 9 years ago
committed by GitHub
parent
commit
d8fc453b37
  1. 2
      .gitmodules
  2. 1
      build/Markup.props
  3. 2
      packages.cake
  4. 2
      src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs
  5. 6
      src/Markup/Avalonia.Markup.Xaml/Converters/SetterValueTypeConverter.cs
  6. 14
      src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlObjectWriter.cs
  7. 7
      src/Markup/Avalonia.Markup.Xaml/PortableXaml/AvaloniaXamlType.cs
  8. 2
      src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github

2
.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

1
build/Markup.props

@ -9,5 +9,6 @@
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
</ItemGroup>
</Project>

2
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)

2
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;
}

6
src/Markup/Avalonia.Markup.Xaml/Converters/SetterValueTypeConverter.cs

@ -23,11 +23,11 @@ namespace Avalonia.Markup.Xaml.Converters
object setter = context.GetService<IProvideValueTarget>().TargetObject;
var schemaContext = context.GetService<IXamlSchemaContextProvider>().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;

14
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

7
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);
}

2
src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github

@ -1 +1 @@
Subproject commit d50730ab59aed99cd2f8aeb4975fcc19d23bb54f
Subproject commit dfc5affa5d8f4ddf5a7707e3202d5593519de640
Loading…
Cancel
Save