Beispiel #1
0
        public void Attach(AutoGridColumnContext context)
        {
            if (context.DataGrid.IsReadOnly || context.Args.Column.IsReadOnly)
            {
                return;
            }

            var selectFromListAttr = context.GetAttribute <SelectFromListAttribute>();

            if (selectFromListAttr == null)
            {
                return;
            }

            if (selectFromListAttr.FromOwnerContext)
            {
                var prop  = context.DataGrid.DataContext.GetType().GetProperty(selectFromListAttr.CollectionPropertyName);
                var value = prop.GetValue(context.DataGrid.DataContext) as IEnumerable;
                context.Args.Column = WpfHelpers.CreateComboboxColumnWithStaticItemsSource(
                    value, context.Property.Name);
            }
            else
            {
                context.Args.Column = WpfHelpers.CreateComboboxColumnWithItemsSourcePerRow(
                    selectFromListAttr.CollectionPropertyName, context.Property.Name);
            }
        }
Beispiel #2
0
        public void Attach(AutoGridColumnContext context)
        {
            var index = context.GetAttribute <DisplayIndexAttribute>()?.Index;

            if (index.HasValue)
            {
                context.Args.Column.DisplayIndex = index.Value;
            }
        }
Beispiel #3
0
        public void Attach(AutoGridColumnContext context)
        {
            var isReadOnly = context.GetAttribute <ReadOnlyAttribute>()?.IsReadOnly;

            if (isReadOnly == true)
            {
                context.Args.Column.IsReadOnly = true;
            }
        }
Beispiel #4
0
        public void Attach(AutoGridColumnContext context)
        {
            if (!typeof(ICommand).IsAssignableFrom(context.Property.PropertyType))
            {
                return;
            }

            var icon = context.GetAttribute <IconAttribute>()?.Name;

            context.Args.Column = WpfHelpers.CreateButtonColumn(context.Property.Name, icon);
        }
Beispiel #5
0
        public void Attach(AutoGridColumnContext context)
        {
            var format = context.GetAttribute <DisplayFormatAttribute>();

            if (format == null)
            {
                return;
            }

            context.GetBinding().StringFormat = format.DataFormatString;
        }
Beispiel #6
0
        public void Attach(AutoGridColumnContext context)
        {
            var style = context.GetAttribute <StyleAttribute>();

            if (style == null)
            {
                return;
            }

            WpfHelpers.SetCellHorizontalAlignment(context.Args.Column, style.HorizontalAlignment);
        }
        public void Attach(AutoGridColumnContext context)
        {
            var iconAttr = context.GetAttribute <IconSourceAttribute>();

            if (iconAttr == null)
            {
                return;
            }

            context.Args.Column = CreateColumnWithImage(context.Property.Name,
                                                        iconAttr.IconPropertyPath, fixedSize: iconAttr.FixedSize,
                                                        imageIsPath: true, hideText: iconAttr.HideText);
        }
        public void Attach(AutoGridColumnContext context)
        {
            var converterAttr = context.GetAttribute <ValueConverterAttribute>();

            if (converterAttr == null)
            {
                return;
            }

            var binding = context.GetBinding();

            binding.Converter = (IValueConverter)Activator.CreateInstance(converterAttr.ValueConverterType);
        }
        public void Attach(AutoGridColumnContext context)
        {
            var path = context.GetAttribute <TooltipSourceAttribute>()?.Path;

            if (path == null)
            {
                return;
            }

            var style   = WpfHelpers.EnsureDefaultCellStyle(context.Args.Column);
            var binding = new Binding(path);

            style.Setters.Add(new Setter(ToolTipService.ToolTipProperty, binding));
        }