public PerspexWiringContext(ITypeFactory typeFactory) { var featureProvider = new TypeFeatureProvider(GetContentPropertyProvider(), GetConverterProvider()); var xamlNamespaceRegistry = CreateXamlNamespaceRegistry(); var perspexPropertyBinder = new PerspexPropertyBinder(featureProvider.ConverterProvider); var xamlTypeRepository = new PerspexTypeRepository(xamlNamespaceRegistry, typeFactory, featureProvider, perspexPropertyBinder); var typeContext = new TypeContext(xamlTypeRepository, xamlNamespaceRegistry, typeFactory); _context = new WiringContext(typeContext, featureProvider); }
private static ITypeContext CreateTypeContext(ITypeFactory typeFactory, TypeFeatureProvider featureProvider) { var xamlNamespaceRegistry = CreateXamlNamespaceRegistry(); var typeRepository = new PerspexTypeRepository(xamlNamespaceRegistry, typeFactory, featureProvider); typeRepository.RegisterMetadata(new Metadata <Setter>().WithMemberDependency(x => x.Value, x => x.Property)); typeRepository.RegisterMetadata( new Metadata <SelectingItemsControl>() .WithMemberDependency(x => x.SelectedIndex, x => x.Items) .WithMemberDependency(x => x.SelectedItem, x => x.Items)); return(new TypeContext(typeRepository, xamlNamespaceRegistry, typeFactory)); }
public TestRuntimeTypeSource() { var namespaceRegistry = CreateNamespaceRegistry(); var featureProvider = new TypeFeatureProvider(new TypeConverterProvider()); featureProvider.FillFromAttributes(ScannedAssemblies.AllExportedTypes()); testTypeRepository = new TestTypeRepository(namespaceRegistry, new TypeFactory(), featureProvider); inner = new RuntimeTypeSource(testTypeRepository, namespaceRegistry); inner.RegisterPrefix(new PrefixRegistration("", "root")); inner.RegisterPrefix(new PrefixRegistration("x", "another")); }
private static IRuntimeTypeSource CreateRuntimeTypeSource() { var typeFactory = new MultiFactory( new List <TypeFactoryRegistration> { new TypeFactoryRegistration(new TypeFactory(), type => type != typeof(ChildClass)), new TypeFactoryRegistration(new TypeFactoryMock((type, args) => new ChildClass { Name = "InnerName" }), type => type == typeof(ChildClass)), }); var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider()); var xamlTypeRepository = new TypeRepository(new NamespaceRegistry(), typeFactory, typeFeatureProvider); var typeSource = new RuntimeTypeSource(xamlTypeRepository, new NamespaceRegistry()); typeFeatureProvider.RegisterMetadata(typeof(DummyObject), new Metadata { RuntimePropertyName = "Name" }); return(typeSource); }
public PerspexWiringContext(ITypeFactory typeFactory, TypeFeatureProvider featureProvider) : base(CreateTypeContext(typeFactory, featureProvider), featureProvider) { }
private static IRuntimeTypeSource CreateRuntimeTypeSource() { var typeFactory = new MultiFactory( new List<TypeFactoryRegistration> { new TypeFactoryRegistration(new TypeFactory(), type => type != typeof (ChildClass)), new TypeFactoryRegistration(new TypeFactoryMock((type, args) => new ChildClass {Name = "InnerName"}), type => type == typeof (ChildClass)), }); var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider()); var xamlTypeRepository = new TypeRepository(new NamespaceRegistry(), typeFactory, typeFeatureProvider); var typeSource = new RuntimeTypeSource(xamlTypeRepository, new NamespaceRegistry()); typeFeatureProvider.RegisterMetadata(typeof (DummyObject), new Metadata {RuntimePropertyName = "Name"}); return typeSource; }
public AvaloniaWiringContext(ITypeFactory typeFactory, TypeFeatureProvider featureProvider) : base(CreateTypeContext(typeFactory, featureProvider), featureProvider) { }