Exemplo n.º 1
0
        public StyleBuilder <T> SetHtmlControlProperty(DotvvmProperty property, string tag, Action <StyleBuilder <HtmlGenericControl> >?styleBuilder = null, StyleOverrideOptions options = StyleOverrideOptions.Overwrite)
        {
            if (tag == null)
            {
                throw new ArgumentNullException(nameof(tag));
            }

            var innerControlStyleBuilder = new StyleBuilder <HtmlGenericControl>(null, false);

            styleBuilder?.Invoke(innerControlStyleBuilder);

            var value = new CompileTimeStyleBase.PropertyControlCollectionInsertionInfo(property, options,
                                                                                        new ControlResolverMetadata(typeof(HtmlGenericControl)), innerControlStyleBuilder.GetStyle(), ctorParameters: new object[] { tag });

            style.SetProperties.Add((property, value));

            return(this);
        }
Exemplo n.º 2
0
        public StyleBuilder <T> SetLiteralControlProperty(DotvvmProperty property, string text, StyleOverrideOptions options = StyleOverrideOptions.Overwrite)
        {
            var innerControlStyleBuilder = new StyleBuilder <RawLiteral>(null, false);

            var ctorParameters = new object[] {
                WebUtility.HtmlEncode(text),
                text,
                String.IsNullOrWhiteSpace(text)
            };

            var value = new CompileTimeStyleBase.PropertyControlCollectionInsertionInfo(property, options,
                                                                                        new ControlResolverMetadata(typeof(RawLiteral)), innerControlStyleBuilder.GetStyle(), ctorParameters);

            style.SetProperties.Add((property, value));;

            return(this);
        }
Exemplo n.º 3
0
        public StyleBuilder <T> SetControlProperty <TControlType>(DotvvmProperty property, Action <StyleBuilder <TControlType> >?styleBuilder = null,
                                                                  StyleOverrideOptions options = StyleOverrideOptions.Overwrite)
        {
            var innerControlStyleBuilder = new StyleBuilder <TControlType>(null, false);

            styleBuilder?.Invoke(innerControlStyleBuilder);

            var value = new CompileTimeStyleBase.PropertyControlCollectionInsertionInfo(property, options,
                                                                                        new ControlResolverMetadata(typeof(TControlType)), innerControlStyleBuilder.GetStyle(), ctorParameters: null);

            style.SetProperties.Add((property, value));

            return(this);
        }