Пример #1
0
        public IVMPropertyDescriptor <IVMCollection <TChildVM> > CollectionProperty <TChildVM>(
            IVMDescriptor itemDescriptor,
            IBehavior valueAccessor,
            IBehavior sourceAccessor = null,
            Action <BehaviorChainConfiguration> chainConfigurationAction = null
            ) where TChildVM : IViewModel
        {
            return(CustomProperty <IVMCollection <TChildVM> >(
                       DefaultBehaviorChainTemplateKeys.CollectionProperty,
                       BehaviorFactoryConfigurations.ForChildProperty <TOwnerVM, TChildVM, TSourceObject>(),
                       config => {
                config.Enable(PropertyBehaviorKeys.ValueAccessor, valueAccessor);

                config.Enable(
                    CollectionPropertyBehaviorKeys.ItemDescriptorProvider,
                    new ItemDescriptorProviderBehavior(itemDescriptor)
                    );

                if (sourceAccessor != null)
                {
                    config.Enable(PropertyBehaviorKeys.SourceAccessor, sourceAccessor);
                }
            },
                       chainConfigurationAction
                       ));
        }
Пример #2
0
 public void ReplaceConfiguration(BehaviorChainTemplateKey templateKey)
 {
     _configuration.ViewModelConfiguration = BehaviorChainConfiguration.GetConfiguration(
         templateKey,
         BehaviorFactoryConfigurations.ForViewModel <TVM>()
         );
 }
Пример #3
0
 public IVMPropertyDescriptor <TValue> PropertyWithSource <TValue>(
     IBehavior valueAccessor,
     Action <BehaviorChainConfiguration> chainConfigurationAction = null
     )
 {
     return(CustomProperty <TValue>(
                DefaultBehaviorChainTemplateKeys.PropertyWithSource,
                BehaviorFactoryConfigurations.ForSimpleProperty <TOwnerVM, TValue, TSourceObject>(true),
                config => config.Enable(PropertyBehaviorKeys.ValueAccessor, valueAccessor),
                chainConfigurationAction
                ));
 }
Пример #4
0
 public IVMPropertyDescriptor <ICommand> CommandProperty(
     IBehavior sourceObjectAccessor,
     IBehavior commandExecutor,
     Action <BehaviorChainConfiguration> chainConfigurationAction = null
     )
 {
     return(CustomProperty <ICommand>(
                DefaultBehaviorChainTemplateKeys.CommandProperty,
                BehaviorFactoryConfigurations.ForSimpleProperty <TOwnerVM, ICommand, TSourceObject>(false),
                config => {
         config.Enable(PropertyBehaviorKeys.SourceAccessor, sourceObjectAccessor);
         config.Enable(CommandPropertyBehaviorKeys.CommandExecutor, commandExecutor);
     },
                chainConfigurationAction
                ));
 }
Пример #5
0
        public IVMPropertyDescriptor <TChildVM> ViewModelPropertyWithSource <TChildVM, TChildSource>(
            IBehavior valueAccessor,
            IBehavior sourceAccessor = null,
            Action <BehaviorChainConfiguration> chainConfigurationAction = null
            ) where TChildVM : IViewModel, IHasSourceObject <TChildSource>
        {
            return(CustomProperty <TChildVM>(
                       DefaultBehaviorChainTemplateKeys.ViewModelPropertyWithSource,
                       BehaviorFactoryConfigurations.ForChildProperty <TOwnerVM, TChildVM, TSourceObject, TChildSource>(),
                       config => {
                config.Enable(PropertyBehaviorKeys.ValueAccessor, valueAccessor);

                if (sourceAccessor != null)
                {
                    config.Enable(PropertyBehaviorKeys.SourceAccessor, sourceAccessor);
                }
            },
                       chainConfigurationAction
                       ));
        }