Welcome to the Xceed Community | Help
Community Search  
More Search Options

Problem hosting a WPF drop down control in an Xceed Win Forms GridControl.

Sort Posts: Previous Next
  •  02-15-2010, 12:05 PM Post no. 25786

    Problem hosting a WPF drop down control in an Xceed Win Forms GridControl.

    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);}
         }
    }

  •  02-15-2010, 1:35 PM Post no. 25795 in reply to 25786

    Re: Problem hosting a WPF drop down control in an Xceed Win Forms GridControl.

    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

            }


    Xceed - Software Developer and Technical Support
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.