i can't see a context menu of WPF windows app

2019-02-21 00:39发布

问题:

I can open a context menu but cannot see the opened menu list through VNC. (I know that i can open the context menu by checking the vnc server machine directly) I tested on different vnc servers / clients machines (although all of them are windows Vista), and different wpf app, but still I cant see any menu list.

Is this a reported problem? I found some information about wpf problem relating to windows desktop, but i dont know about vnc.

ADDED : I dont have this problem on windows native apps or windows forms apps under my vnc environment.

回答1:

I have not read/found any known issue regarding viewing WPF applications across a remote connection. However if you think about how remote connections work I would like hazard a few guesses to the problem and even maybe a solution.

When you install any remote desktop software you really doing two things: setting up a repeater to relay input commands and adding a display adapter that acts as a frame server, i.e., instead of outputting the contents of the screen to a monitor it sends the information over the network.

As you know, WPF utilises DirectX to accelerate its rendering (GPU bound) and it is an unfortunate limitation that all graphic card acceleration does not work via remote desktop connection.

What I believe is happening in your specific case is that WPF is not falling back to using it's software rendering pipeline when it attempts to draw the context menu - perhaps because the context menu is a Popup and in a separate visual tree.

Something worth trying would be to force your WPF application to use software rendering.

void OnLoaded(object sender, EventArgs e)
{
    HwndSource hwndSource = (HwndSource)PresentationSource.FromVisual(this);
    HwndTarget hwndTarget = hwndSource.CompositionTarget;

    hwndTarget.RenderMode = RenderMode.SoftwareOnly;
}

If this does prove to be the case, you have two options: force WPF to use software rendering pipeline or try deploying a high-performance remote desktop access software solution from Hewlett Packard.

HTH,

References
- Microsoft guidelines for troubleshooting graphic issues in WPF.
- Hardware Acceleration in WPF
- HP Remote Graphics Software


Update: For others searching and finding this answer, you need change a VNC client setting to enable alpha blending. As noted by @mcdrewski that by default VNC won't detect/render alpha blended windows. Enabling alpha blending incurs a cost and you will notice the VNC client lag a bit.



回答2:

The solution is: check the "Capture alpha blending" option in VNC Server's admin properties -- henon



回答3:

The only way I have been able to make Alpha blended windows or menus show up in VNC is to turn off the "Blank the screen while VNC viewers are connected" option under Desktop in the VNCconfig app for the server.



回答4:

Is it just happening on WPF applications or any other apps? Try to change the desktop color quality to 16 bit.



回答5:

In the VNC server option look for the option named UseCaptureBlt and mark it TRUE



标签: wpf vnc