9 changed files with 162 additions and 76 deletions
@ -0,0 +1,29 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Markup.Xaml.Styling; |
|||
using Avalonia.Styling; |
|||
using Portable.Xaml; |
|||
using Portable.Xaml.ComponentModel; |
|||
using Portable.Xaml.Markup; |
|||
using System; |
|||
|
|||
namespace Avalonia.Markup.Xaml.MarkupExtensions |
|||
{ |
|||
[MarkupExtensionReturnType(typeof(IStyle))] |
|||
public class StyleIncludeExtension : MarkupExtension |
|||
{ |
|||
public StyleIncludeExtension() |
|||
{ |
|||
} |
|||
|
|||
public override object ProvideValue(IServiceProvider serviceProvider) |
|||
{ |
|||
var tdc = (ITypeDescriptorContext)serviceProvider; |
|||
|
|||
return new StyleInclude(tdc.GetBaseUri()) { Source = Source }; |
|||
} |
|||
|
|||
public Uri Source { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using Portable.Xaml; |
|||
using System; |
|||
using System.Reflection; |
|||
|
|||
namespace Avalonia.Markup.Xaml.PortableXaml |
|||
{ |
|||
public class AvaloniaXamlContext |
|||
{ |
|||
internal AvaloniaXamlContext(Uri baseUri, Assembly localAssembly) |
|||
{ |
|||
LocalAssembly = localAssembly; |
|||
BaseUri = baseUri; |
|||
} |
|||
|
|||
public Assembly LocalAssembly { get; } |
|||
|
|||
public Uri BaseUri { get; } |
|||
|
|||
public static implicit operator AvaloniaXamlContext(XamlXmlReaderSettings sett) |
|||
{ |
|||
return new AvaloniaXamlContext(sett.BaseUri, sett.LocalAssembly); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue