WPF Application Render Problem in ADXExcelTaskPane

Add-in Express™ Support Service
That's what is more important than anything else

WPF Application Render Problem in ADXExcelTaskPane
 
Ramesh Shrestha




Posts: 63
Joined: 2011-01-03
Hi,

when ever I hover the mouse arrow over the show/hide button on border of taskpane then WPF Application get Render (screen Drawing) Problem, which I try to show in this screenshot, http://screencast.com/t/yT1gCBGT

I am looking forward to you.

Regards
Ramesh Shrestha
Posted 04 Jan, 2011 03:13:33 Top
Eugene Astafiev


Guest


Hi Ramesh,

Thank you for pointing this to me. However, I have found the following entry in the http://www.add-in-express.com/news-latest.php section:

Various issues remain in all Office and .NET Framework versions caused by a partial incompatibility of the WPF core and Office GUI.


Please try to use the System.Window.Forms controls instead.
Posted 04 Jan, 2011 04:32:40 Top
Ramesh Shrestha




Posts: 63
Joined: 2011-01-03
Hi Eugene Astafiev,

Thank you for reply.
I work around for this wpf window rendering issue by disabling the Hardware Acceleration.
here is the mock up code:


using ...
using System.Windows.Interop;

namespace BirayWpfControlLibrary
{
public partial class WpfControl : UserControl
{
public WpfControl()
{
InitializeComponent();
}

private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
bool ForceSoftware = true;
if (ForceSoftware)
{
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
HwndTarget hwndTarget = hwndSource.CompositionTarget;

// this is the new WPF API to force render mode.
hwndTarget.RenderMode = RenderMode.SoftwareOnly;
}
}
}
}

Thanking you

Regards
Ramesh Shrestha
Posted 04 Jan, 2011 05:11:08 Top
Eugene Astafiev


Guest


Hi Ramesh,

Thank you for sharing the solution for others. Good luck with your add-in project!
Posted 04 Jan, 2011 05:23:53 Top