WindowsFormsHost not visible with EditorStyle DropDown?

4 posts, 1 answers
  1. Mitchell
    Mitchell avatar
    45 posts
    Member since:
    Mar 2013

    Posted 18 Mar 2015 Link to this post

    I have a windows forms control I want to use as part of a custom editor. I created a WPF usercontrol as a wrapper and set my winforms usercontrol as the child of a WindowsFormsHost element. I have a TextBlock in the WPF usercontrol as well, so I can see where the WPF content is and where the winforms content is. I applied an EditorAttribute to a property with the style set to DropDown. The WPF TextBlock is visible, a border around the winforms content is visible, but the winforms usercontrol is not shown.  If I change the editor style to Modal, all of the content is shown correctly in the modal dialog.  Are there restrictions or known problems with using WindowsFormsHost in an editor with the DropDown style?  Thanks - Mitch
  2. Answer
    Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 19 Mar 2015 Link to this post

    Hi Mitchell,


    We are not aware of any restrictions and issues, while using WindowsFormsHost in such scenario. In order to provide you with an appropriate solution it would be best to isolate the problem in a small sample project that we could test by our side. You could send us this application demo as an attachment in a new support thread. 


    I look forward to hearing from you. 


    Regards,
    Vanya Pavlova
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Mitchell
    Mitchell avatar
    45 posts
    Member since:
    Mar 2013

    Posted 19 Mar 2015 in reply to Vanya Pavlova Link to this post

    I've submitted a support ticket so that I could attach a sample project. When the ticket is resolved, I'll post the resolution back here & mark my question as answered.  Thanks - Mitch
  5. Mitchell
    Mitchell avatar
    45 posts
    Member since:
    Mar 2013

    Posted 25 Mar 2015 in reply to Mitchell Link to this post

    For those interested in a "solution". Support provided me with the reason for the issue: the Popup instance used in the DropDownEditor has AllowsTransparency set to true. This prevents the winforms content from showing up in the drop down. I was able to set AllowsTransparency to false (for the Popup) by doing the following:

    1) Subscribe to the property grid's FieldLoaded event
    2) In the FieldLoaded handler, if e.Field.Content is a DropDownEditor, subscribe to the Loaded event of e.Field
    3) In that handler (Field_Loaded), find the Popup in the visual tree of the DropDownEditor (which is the content of the sender).
    4) Set AllowsTransparency to false for the Popup.

    This is obviously dependent on implementation of the property grid.
Back to Top