示例#1
0
        /// <summary>
        /// Registers the specified DotVVM property.
        /// </summary>
        public static DotvvmPropertyWithFallback Register <TPropertyType, TDeclaringType>(string propertyName, DotvvmProperty defaultProperty, bool defaultPropertyInherit, bool isValueInherited = false)
        {
            var property = new DotvvmPropertyWithFallback()
            {
                DefaultProperty = defaultProperty, DefaultPropertyInherit = defaultPropertyInherit
            };

            return(DotvvmProperty.Register <TPropertyType, TDeclaringType>(propertyName, isValueInherited: isValueInherited, property: property) as DotvvmPropertyWithFallback);
        }
示例#2
0
        public static CommandBindingExpression RegisterExtensionCommand(this DotvvmControl control, Delegate action, string methodUsageId)
        {
            var id           = control.GetDotvvmUniqueId() + methodUsageId;
            var propertyName = control.GetType().FullName + "/" + methodUsageId;
            var property     = DotvvmProperty.Register <object, ExtensionCommands>(propertyName);
            var binding      = new CommandBindingExpression(action, id);

            control.SetBinding(property, binding);
            return(binding);
        }
示例#3
0
        public static CommandBindingExpression RegisterExtensionCommand(this DotvvmControl control, Delegate action, string methodUsageId)
        {
            var bindingService = control.GetValue(Internal.RequestContextProperty).CastTo <IDotvvmRequestContext>()
                                 .Configuration.ServiceLocator.GetService <BindingCompilationService>();
            var id           = control.GetDotvvmUniqueId() + methodUsageId;
            var propertyName = control.GetType().FullName + "/" + methodUsageId;
            var property     = DotvvmProperty.Register <object, PropertyBox>(propertyName);
            var binding      = new CommandBindingExpression(bindingService, action, id);

            control.SetBinding(property, binding);
            return(binding);
        }
示例#4
0
 public static DelegateActionProperty <TValue> Register <TDeclaringType>(string name, Action <IHtmlWriter, IDotvvmRequestContext, DotvvmProperty, DotvvmControl> func, TValue defaultValue = default(TValue))
 {
     return((DelegateActionProperty <TValue>)DotvvmProperty.Register <TValue, TDeclaringType>(name, defaultValue, false, new DelegateActionProperty <TValue>(func)));
 }
示例#5
0
        public static CommandBindingExpression RegisterExtensionCommand(this DotvvmControl control, Delegate action, string methodUsageId)
        {
            var bindingService = control.GetValue(Internal.RequestContextProperty).CastTo <IDotvvmRequestContext>()
                                 .Configuration.ServiceProvider.GetRequiredService <BindingCompilationService>();
            var id           = control.GetDotvvmUniqueId() + methodUsageId;
            var propertyName = control.GetType().FullName + "/" + methodUsageId;
            var property     = DotvvmProperty.ResolveProperty(typeof(PropertyBox), propertyName) ?? DotvvmProperty.Register(propertyName, typeof(object), typeof(PropertyBox), null, false, null, typeof(PropertyBox), throwOnDuplicitRegistration: false);
            var binding      = new CommandBindingExpression(bindingService, action, id);

            control.SetBinding(property, binding);
            return(binding);
        }