private void GridControlHandleCreated(object sender, EventArgs e) { if (_GridControl != sender) { _GridControl = sender as GridControl; if (_GridControl != null) { _FilterPanel = new PanelControl(); buttonsContainer = new ButtonsContainer(); _FilterPanel.BeginInit(); _FilterPanel.SuspendLayout(); // buttonsContainer buttonsContainer.Location = new Point(0, 0); buttonsContainer.AllowCustomization = false; buttonsContainer.ContainerId = FilterPanelGroup; buttonsContainer.HideItemsCompletely = false; buttonsContainer.Name = "filterPanelButtonsContainer"; buttonsContainer.ActionItemAdding += ButtonsContainer_ActionItemAdding; // _FilterPanel _FilterPanel.Controls.Add(buttonsContainer); _FilterPanel.Padding = new Forms.Padding(2, 6, 2, 6); buttonsContainer.Dock = Forms.DockStyle.Fill; _FilterPanel.Name = nameof(_FilterPanel); _FilterPanel.Height = 40; _FilterPanel.TabIndex = 1; _FilterPanel.Dock = ((IModelFilterPanel)View.Model).FilterPanelPosition; if (!_GridControl.FormsUseDefaultLookAndFeel) { _FilterPanel.LookAndFeel.Assign(_GridControl.LookAndFeel); buttonsContainer.LookAndFeel.Assign(_GridControl.LookAndFeel); } _FilterPanel.EndInit(); _FilterPanel.ResumeLayout(false); if (Frame != null && Frame.Template != null) { var template = Frame.Template as IDynamicContainersTemplate; if (template != null) { template.RegisterActionContainers(new IActionContainer[] { buttonsContainer }); } } var ff = buttonsContainer.ActionItems.FirstOrDefault(t => t.Key.Id == newFilterFieldsAction.Id); if (ff.Value != null && ff.Value.LayoutItem != null) { ff.Value.LayoutItem.Spacing = new DevExpress.XtraLayout.Utils.Padding(12, 0, 0, 0); } if (_GridControl.Parent != null) { _GridControl.Parent.Controls.Add(_FilterPanel); } else { _GridControl.ParentChanged += GridControlParentChanged; } UpdateActionState(); OnFilterControlCreated(EventArgs.Empty); } } }