示例#1
0
        public static IColumnConfigurator <T, TLink, TFilter> Icon <T, TLink, TFilter>(this IColumnConfigurator <T, TLink, TFilter> c, Func <T, string> getPath, double size = 30.0)
            where T : class, IEntity, new()
            where TFilter : IFilter <TLink>
        {
            var getContent = c.Column.Getter;

            if (getContent == null)
            {
                return(c.Content(t => new IconView {
                    Path = getPath(t), IconMaxHeight = size, IconMaxWidth = size
                }));
            }

            return(c.Content(t => new IconView {
                Path = getPath(t) ?? "", IconMaxHeight = size, IconMaxWidth = size, Caption = getContent(t) ?? ""
            }));
        }
示例#2
0
        public static IColumnConfigurator <T, TLink, TFilter> Center <T, TLink, TFilter>(this IColumnConfigurator <T, TLink, TFilter> c)
            where T : class, IEntity, new()
            where TFilter : IFilter <TLink>
        {
            var getContent = c.Column.Getter;

            return(c.Content(t => new ContentControl {
                VerticalAlignment = VerticalAlignment.Stretch, Content = getContent?.Invoke(t)
            }));
        }
示例#3
0
        public static IColumnConfigurator <T, TLink, TFilter> Localize <T, TLink, TFilter>(this IColumnConfigurator <T, TLink, TFilter> c)
            where T : class, IEntity, new()
            where TFilter : IFilter <TLink>
        {
            var getContent = c.Column.Getter;

            if (getContent != null)
            {
                return(c.Content(e => new Localize {
                    Id = (string)getContent(e)
                }));
            }
            else if (c.Column.Header is string header)
            {
                return(c.Header(new Localize {
                    Id = header
                }));
            }
            throw new NullReferenceException("Localize must be used on existing content");
        }