This is a migrated thread and some comments may be shown as answers.

WindowsFormsHost not visible with EditorStyle DropDown?

3 Answers 180 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Mitchell
Top achievements
Rank 1
Mitchell asked on 18 Mar 2015, 04:56 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 19 Mar 2015, 12:02 PM
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.

 
0
Mitchell
Top achievements
Rank 1
answered on 19 Mar 2015, 04:36 PM
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
0
Mitchell
Top achievements
Rank 1
answered on 25 Mar 2015, 03:18 PM
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.
Tags
PropertyGrid
Asked by
Mitchell
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Mitchell
Top achievements
Rank 1
Share this question
or