Пример #1
0
        private void UpdateColumns()
        {
            this.Dispatcher.InvokeAsync(
                () =>
            {
                this.ColumnDefinitions.Clear();
                int i = 0;
                foreach (FrameworkElement item in this.Children.Cast <FrameworkElement>())
                {
                    EntityGroup entityGroup = (EntityGroup)item.DataContext;

                    ColumnDefinition columnDefinition = new ColumnDefinition()
                    {
                        DataContext = entityGroup
                    };
                    Grid.SetColumn(item, i);

                    if (entityGroup.IsVisible)
                    {
                        columnDefinition.SetBinding(ColumnDefinition.WidthProperty, "Width");
                    }
                    else
                    {
                        columnDefinition.Width = new GridLength(0);
                    }

                    this.ColumnDefinitions.Add(columnDefinition);

                    ++i;
                }
            });
        }
Пример #2
0
        /// <summary>
        /// The resolve groups.
        /// </summary>
        private void ResolveGroups()
        {
            this.InternalView.Groups.Clear();

            foreach (ElasticGroup elasticGroup in this.View.Groups)
            {
                EntityGroup entityGroup = new EntityGroup()
                {
                    Header = elasticGroup.Header,
                    HeaderTemplate = elasticGroup.HeaderTemplate,
                    IsCountVisible = elasticGroup.IsCountVisible,
                    IsFilterEnabled = elasticGroup.IsFilterEnabled,
                    IsResetButtonVisible = elasticGroup.IsResetButtonVisible,
                    IsSelectAllButtonVisible = elasticGroup.IsSelectAllButtonVisible,
                    IsVisible = elasticGroup.IsVisible,
                    MaxHeight = elasticGroup.MaxHeight,
                    MinDisabledHeight = elasticGroup.MinDisabledHeight,
                    MinEnabledHeight = elasticGroup.MinEnabledHeight,
                    NumberFormat = elasticGroup.NumberFormat,
                    SelectionMode = elasticGroup.SelectionMode,
                    SortDirection = elasticGroup.SortDirection,
                    SortMode = elasticGroup.SortMode,
                    Width = elasticGroup.Width
                };
                elasticGroup.EntityGroup = entityGroup;
                entityGroup.SelectionChanged += this.OnSelectionChanged;

                foreach (object item in this.Items)
                {
                    object content = elasticGroup.DisplayMemberBinding.Resolve(item);

                    // Handle null group values.
                    if (content == null)
                    {
                        content = elasticGroup.NullContent;
                    }

                    Entity entity;
                    if (entityGroup.Entities.Contains(content))
                    {
                        entity = entityGroup.Entities[content];
                    }
                    else
                    {
                        entity = new Entity(entityGroup)
                        {
                            Content = content,
                            ContentTemplate = elasticGroup.ContentTemplate,
                            IsEnabled = true,
                            IsSelected = false,
                            Total = 0,
                            Value = 0
                        };
                        entityGroup.Entities.Add(entity);
                    }

                    entity.Items.Add(item);
                    ++entity.Value;
                    ++entity.Total;
                }

                this.InternalView.Groups.Add(entityGroup);
            }

            this.Update();
        }
Пример #3
0
 /// <summary>
 /// Initialises a new instance of the <see cref="Entity"/> class.
 /// </summary>
 /// <param name="group">The group.</param>
 public Entity(EntityGroup group)
 {
     this.group = group;
     this.items = new ObservableCollection <object>();
 }
Пример #4
0
 /// <summary>
 /// Initialises a new instance of the <see cref="Entity"/> class.
 /// </summary>
 /// <param name="group">The group.</param>
 public Entity(EntityGroup group)
 {
     this.group = group;
     this.items = new ObservableCollection<object>();
 }
Пример #5
0
        /// <summary>
        /// The resolve groups.
        /// </summary>
        private void ResolveGroups()
        {
            this.InternalView.Groups.Clear();

            foreach (ElasticGroup elasticGroup in this.View.Groups)
            {
                EntityGroup entityGroup = new EntityGroup()
                {
                    Header                   = elasticGroup.Header,
                    HeaderTemplate           = elasticGroup.HeaderTemplate,
                    IsCountVisible           = elasticGroup.IsCountVisible,
                    IsFilterEnabled          = elasticGroup.IsFilterEnabled,
                    IsResetButtonVisible     = elasticGroup.IsResetButtonVisible,
                    IsSelectAllButtonVisible = elasticGroup.IsSelectAllButtonVisible,
                    IsVisible                = elasticGroup.IsVisible,
                    MaxHeight                = elasticGroup.MaxHeight,
                    MinDisabledHeight        = elasticGroup.MinDisabledHeight,
                    MinEnabledHeight         = elasticGroup.MinEnabledHeight,
                    NumberFormat             = elasticGroup.NumberFormat,
                    SelectionMode            = elasticGroup.SelectionMode,
                    SortDirection            = elasticGroup.SortDirection,
                    SortMode                 = elasticGroup.SortMode,
                    Width = elasticGroup.Width
                };
                elasticGroup.EntityGroup      = entityGroup;
                entityGroup.SelectionChanged += this.OnSelectionChanged;

                foreach (object item in this.Items)
                {
                    object content = elasticGroup.DisplayMemberBinding.Resolve(item);

                    // Handle null group values.
                    if (content == null)
                    {
                        content = elasticGroup.NullContent;
                    }

                    Entity entity;
                    if (entityGroup.Entities.Contains(content))
                    {
                        entity = entityGroup.Entities[content];
                    }
                    else
                    {
                        entity = new Entity(entityGroup)
                        {
                            Content         = content,
                            ContentTemplate = elasticGroup.ContentTemplate,
                            IsEnabled       = true,
                            IsSelected      = false,
                            Total           = 0,
                            Value           = 0
                        };
                        entityGroup.Entities.Add(entity);
                    }

                    entity.Items.Add(item);
                    ++entity.Value;
                    ++entity.Total;
                }

                this.InternalView.Groups.Add(entityGroup);
            }

            this.Update();
        }