locked
WindowsFormsHost in PageFunction not working... RRS feed

  • Question

  • Hi all,

     

    Has anyone been able to get WindowsFormsHost working inside a PageFunction?  It works perfectly under Page or Window but invisible in a PageFunction. 

     

    Code Snippet

     

    <PageFunction

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:sys="clr-namespace:System;assembly=mscorlib"

    xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"

    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"

    x:Class="ReportPreviewPageFunc"

    x:TypeArguments="sys:String"

    Title="ReportPreviewPageFunc" Width="800" Height="600">

     

    <Grid Name="grid">

    <wfi:WindowsFormsHost>

    <wf:Button Text="Windows Forms control" FlatStyle="Flat" />

    </wfi:WindowsFormsHost>

    </Grid>

     

    </PageFunction>

     

     

    Am I missing something?  Any suggestions or recommendations will be greatly appreciated. 

     

    Thanks.

     

    Ed

    Wednesday, September 26, 2007 3:28 PM

Answers

  • The PageFunction is inside a transparent window. That is why it does not work. If you take out the transparent properties, you will see the winform controls.

     

    This is because child window does not support transparency. WindowsFormsHost uses a child hwnd to host winforms. This is a hard limitation. Unfortunately, I'm not aware of a workaround.

    Thursday, September 27, 2007 9:27 PM

All replies

  • Our tester is not able to repro this with the sample code. Is it possible for you to provide a simple project? Thanks!

     

    Thursday, September 27, 2007 3:28 AM
  • Hi Hua,

     

    Absolutely.  However, since I don't see anyway to upload a zip file here...so please download it from http://homepage.mac.com/e.ip/PageFunctionTest.zip

     

    Thanks in advance!

     

    Ed

    Thursday, September 27, 2007 1:31 PM
  • I'm not able to see it either.  Using VS2005 w/Orcas extensions (Nov 2006 CTP).

    I haven't tested it on VS2008 Beta 2.
    Thursday, September 27, 2007 4:14 PM
  • The PageFunction is inside a transparent window. That is why it does not work. If you take out the transparent properties, you will see the winform controls.

     

    This is because child window does not support transparency. WindowsFormsHost uses a child hwnd to host winforms. This is a hard limitation. Unfortunately, I'm not aware of a workaround.

    Thursday, September 27, 2007 9:27 PM