<p>How can I go about hosting flash content inside a WPF form and still use transparency/alpha on my WPF window?  Hosting a WinForms flash controls does not allow this.</p>

[{'answer_id': 67188, 'author': 'Charles Graham', 'author_id': 7705, 'author_profile': 'https://Stackoverflow.com/users/7705', 'pm_score': 0, 'selected': False, 'text': '<p>Can you use Expression to convert the flash content to XAML?  I believe that there are tools in there or off to the side that do this.</p>\n'}, {'answer_id': 67914, 'author': 'Alan Le', 'author_id': 1133, 'author_profile': 'https://Stackoverflow.com/users/1133', 'pm_score': 1, 'selected': False, 'text': "<p>Although I haven't done it, you can probably use the WebBrowser control found in WPF 3.5 sp1 to wrap your Flash content within WPF. I'm not sure how the transparency will be affected though.</p>\n"}, {'answer_id': 74553, 'author': 'Brian Stewart', 'author_id': 3114, 'author_profile': 'https://Stackoverflow.com/users/3114', 'pm_score': 3, 'selected': True, 'text': '<p>Unless the control you use to display the Flash content is built in WPF, you will run in to these &quot;airspace&quot; issues. Every display technology from Win32 to WinForms used HWNDs &quot;under the hood&quot;, but WPF uses DirectX. The Window Manager in Windows however, still only understands HWNDs, so WPF apps have one top-level HWND-based window, and everything under that is done in DirectX (actually things like context menus and tooltips also have top-level HWNDs as well). Adam Nathan has a very good description of WPF interop in <a href="http://www.ddj.com/windows/197003872?pgno=1" rel="nofollow noreferrer">this article</a>.</p>\n'}, {'answer_id': 22435069, 'author': 'Ailayna Entarria', 'author_id': 2424285, 'author_profile': 'https://Stackoverflow.com/users/2424285', 'pm_score': -1, 'selected': False, 'text': '<p>Just have been struggling with same problem of how to upload &amp; Make WPF transparent with ability of displaying Flash, because if you enable on your MainWindow "Allow transparency" Flash will not show once the application will run.</p>\n\n<p><strong>1)</strong> I used WebBrowser Control to play Flash(.swf) files. They are on my PC, however it can play from internet or wherever you have hosted them. Don\'t forget to name your WebBrowser Control to get to it in C#.</p>\n\n<pre><code> private void Window_Loaded(object sender, RoutedEventArgs e)\n {   \n    MyHelper.ExtendFrame(this, new Thickness(-1));    \n    this.MyBrowser.Navigate(@"C:\\Happy\\Download\\flash\\PlayWithMEGame.swf");         \n }\n</code></pre>\n\n<p><strong>2)</strong> Now for transparency. I have set in WPF \'false\' to "Allow Transparency" and set "Window Style" to \'None\'. After that I have used information from <a href="https://stackoverflow.com/questions/4253665/wpf-window-transparency-while-hosting-a-flash-activex-component?rq=1">HERE</a> and <a href="http://blogs.msdn.com/b/adam_nathan/archive/2006/05/04/589686.aspx" rel="nofollow noreferrer">HERE</a> and created a following code that produced desired effect of allowing transparency on MainWindow and running Flash at same time, here is my code:</p>\n\n<pre><code>public class MyHelper\n{\n    public static bool ExtendFrame(Window window, Thickness margin)\n    {\n        IntPtr hwnd = new WindowInteropHelper(window).Handle;\n        window.Background = Brushes.Transparent;\n        HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;\n        MARGINS margins = new MARGINS(margin);\n        DwmExtendFrameIntoClientArea(hwnd, ref margins);\n        return true;\n    }\n    [DllImport("dwmapi.dll", PreserveSig = false)]\n    static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);\n}\n\n struct MARGINS\n    {\n        public MARGINS(Thickness t)\n        {\n            Left = (int)t.Left;\n            Right = (int)t.Right;\n            Top = (int)t.Top;\n            Bottom = (int)t.Bottom;\n        }\n        public int Left;\n        public int Right;\n        public int Top;\n        public int Bottom;\n    }\n</code></pre>\n\n<p>And called it from Window_Loaded() + you need \'below\' line for \'DllImport\' to work.</p>\n\n<pre><code>using System.Runtime.InteropServices;\nusing System.Windows.Interop;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/67151', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10119/']