Home Forums WinForms controls Xceed Grid for WinForms Problem hosting a WPF drop down control in an Xceed Win Forms GridControl.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17377 |

    I have a WPF drop down control (illustrated using theComboBox control below) that is host in the Xceed Win Forms GridControl using aCellEditorManager.

    PROBLEM: If I open the drop down and click anywhere in thedrop down that is also overlapping a cell then the drop down disappears and theclick falls through the underlying control. If the drop down is clicked overanother area (outside of the GridControl or outside of a cell area) then theclick is handled by the WPF combo box without problems.

    How can I make the GridControl behave itself and notintercept mouse events?

    EXAMPLE:

    To setup the cell:

    var control = newMyWpfCombo();
    _column.CellEditorManager =
         new CellEditorManager(control,”Text”, true, true);

    And the MyWpfCombo class:

    public classMyWpfCombo : ElementHost
    {
         private readonlySystem.Windows.Controls.ComboBox _combo =
               newSystem.Windows.Controls.ComboBox();

         public MyWpfCombo()
         {
               Child = _combo;

               _combo.BorderThickness = newThickness(0);
               _combo.Padding = newThickness(-1,1,1,1);

               _combo.ItemSource = new[]{“Foo”, “Bar”, “Baz”};

               _combo.IsEditable = true;
         }

         protected override string Text
         {
               get { return (string)_combo.SelectedItem; }
               set { _combo.SelectedItem =value; }
         }

         protected override Size DefaultSize
         {
               get { return new Size(121, 21);}
         }
    }

    Imported from legacy forums. Posted by Peter (had 1387 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Peter,

    You could possibly handle the Mouse events on the GridControl and then implement your desired behavior in the handler. For example, in case of the MouseDoubleClick event you could write the following on the StarterGrid sample. The handler could contain the code that will reactivate the drop down.

    Example:

    starterGrid.MouseDoubleClick += new MouseEventHandler( starterGrid_MouseDoubleClick );

     

    void starterGrid_MouseDoubleClick( object sender, MouseEventArgs e )

            {

                //your processing

            }

    Imported from legacy forums. Posted by Mohamed [Xceed] (had 1075 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.