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 static IRuntimeTypeSource FromAttributes(IEnumerable<Assembly> assemblies)
        {
            var allExportedTypes = assemblies.AllExportedTypes();

            var typeFactory = new TypeFactory();

            var xamlNamespaceRegistry = new NamespaceRegistry();
            xamlNamespaceRegistry.FillFromAttributes(assemblies);

            var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider());
            typeFeatureProvider.FillFromAttributes(allExportedTypes);
                
            var xamlTypeRepo = new TypeRepository(xamlNamespaceRegistry, typeFactory, typeFeatureProvider);

            return new RuntimeTypeSource(xamlTypeRepo, xamlNamespaceRegistry);
        }
Exemple #4
0
        public static IRuntimeTypeSource FromAttributes(IEnumerable <Assembly> assemblies)
        {
            var allExportedTypes = assemblies.AllExportedTypes();

            var typeFactory = new TypeFactory();

            var xamlNamespaceRegistry = new NamespaceRegistry();

            xamlNamespaceRegistry.FillFromAttributes(assemblies);

            var typeFeatureProvider = new TypeFeatureProvider(new TypeConverterProvider());

            typeFeatureProvider.FillFromAttributes(allExportedTypes);

            var xamlTypeRepo = new TypeRepository(xamlNamespaceRegistry, typeFactory, typeFeatureProvider);

            return(new RuntimeTypeSource(xamlTypeRepo, xamlNamespaceRegistry));
        }
 public PerspexWiringContext(ITypeFactory typeFactory, TypeFeatureProvider featureProvider)
     : base(CreateTypeContext(typeFactory, featureProvider), featureProvider)
 {
 }
 public AvaloniaWiringContext(ITypeFactory typeFactory, TypeFeatureProvider featureProvider)
     : base(CreateTypeContext(typeFactory, featureProvider), featureProvider)
 {
 }