Completed
Last Updated: 08 Apr 2019 16:26 by ADMIN
Release R2 2019 (LIB 2019.1.415)
ADMIN
Hristo
Created on: 16 Nov 2016 14:55
Category: MultiColumnCombo
Type: Feature Request
2
IMPROVE. RadMultiColumnComboBox - expose an API for using a custom RadGridView control in the popup form

		
1 comment
ADMIN
Dimitar
Posted on: 08 Apr 2019 16:26
Hello, 
 
A fix will be available in LIB Version 2019.1.415 scheduled for April 15th. Exposing an API for using a custom RadGridView control in the popup form.

When fix is released you will be able to use custom RadGridView as grid element of the MultiColumnComboBox as follows: 
using System;
using Telerik.WinControls;
using Telerik.WinControls.UI;
  
namespace MCCBCustomRadGridView
{
    public partial class RadFormCustomGrid : Telerik.WinControls.UI.RadForm
    {
        public RadFormCustomGrid()
        {
            InitializeComponent();
        }
  
        private void RadFormCustomGrid_Load(object sender, EventArgs e)
        {
            this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
        }
    }
  
    public class MyRadMultiColumnComboBox : RadMultiColumnComboBox
    {
        public override string ThemeClassName
        {
            get
            {
                return typeof(RadMultiColumnComboBox).FullName;
            }
        }
  
        protected override RadMultiColumnComboBoxElement CreateMultiColumnComboBoxElement()
        {
            return new MyRadMultiColumnComboBoxElement();
        }
    }
  
    public class MyRadMultiColumnComboBoxElement : RadMultiColumnComboBoxElement
    {
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(RadMultiColumnComboBoxElement);
            }
        }
  
        protected override RadPopupControlBase CreatePopupForm()
        {
            MultiColumnComboPopupForm popupForm = new MyMultiColumnComboPopupForm(this);
            popupForm.EditorControl.Focusable = false;
            popupForm.MinimumSize = this.DropDownMaxSize;
            popupForm.MaximumSize = this.DropDownMaxSize;
            popupForm.Height = this.DropDownHeight;
            popupForm.VerticalAlignmentCorrectionMode = AlignmentCorrectionMode.SnapToOuterEdges;
            popupForm.HorizontalAlignmentCorrectionMode = AlignmentCorrectionMode.Smooth;
            popupForm.RightToLeft = this.RightToLeft ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.Inherit;
            this.WirePopupFormEvents(popupForm);
  
            return popupForm;
        }
    }
  
    public class MyMultiColumnComboPopupForm : MultiColumnComboPopupForm
    {
        internal bool closed;
  
        public MyMultiColumnComboPopupForm(RadMultiColumnComboBoxElement element)
            : base(element)
        { }
  
        protected override GridViewHostItem CreateEditorElement()
        {
            return new MyGridViewHostItem();
        }
  
  
        /// <summary>
        /// Fires when the popup is opened.
        /// </summary>
        protected override void OnPopupOpened()
        {
            base.OnPopupOpened();
            closed = false;
        }
  
        /// <summary>
        /// Fires when the popup is closed.
        /// </summary>
        /// <param name="args">A RadPopupClosedEventArgs instance
        /// that contains information about what caused the popup to close.</param>
        protected override void OnPopupClosed(RadPopupClosedEventArgs args)
        {
            base.OnPopupClosed(args);
            closed = true;
        }
    }
  
    public class MyGridViewHostItem : GridViewHostItem
    {
        public MyGridViewHostItem()
            : base(new MyRadGridView())
        { }
    }
  
    public class MyRadGridView : RadGridView
    {
        #region Ctor
  
        public MyRadGridView()
        {
            this.GridBehavior = new MultiColumnComboGridBehavior();
        }
  
        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            MyMultiColumnComboPopupForm form = this.Parent as MyMultiColumnComboPopupForm;
            if (form != null && form.closed)
            {
                return;
            }
  
            base.OnMouseDown(e);
        }
        #endregion
  
        #region Methods
  
        protected override bool ProcessFocusRequested(RadElement element)
        {
            return false;
        }
  
        public override string ThemeClassName
        {
            get
            {
                return "Telerik.WinControls.UI.RadGridView";
            }
            set
            {
                base.ThemeClassName = value;
            }
        }
  
        #endregion
    }
}


You can also see the code inside the attached project.

Regards,
Dimitar 
Attached Files: