Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF
Hey all,
 
Does anyone know anything about the odd behaviour my WPF application is experiencing? I'm hoping it's something silly and simple, but it seems that if I interact with another window, e.g, if I minimise Internet Explorer, then my WPF window drops to the back of the desktop z-order.
 
Ideas and suggestions greatly appreciated,
 
Jib
Posted 27-Apr-11 5:49am
Jibrohni1.1K
Comments
SAKryukov at 27-Apr-11 11:29am
   
Do you mean it? Do you really mean ***your*** application?
OK, do you mean: "when I minimize and then restore"?
--SA
Jibrohni at 27-Apr-11 11:40am
   
It's a WCF/WPF application that transfers files from one pc to another. If I minimize an external window such as IE to see my applications UI then it doesn't minimize my applications window, but puts it to the back of all other open desktop windows? Sometimes it loses the start-bar icon too?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I'm not saying you don't have a problem. I'm saying the Question is pointless.
 
When you minimize application, the Z-order is not applicable to it as it goes to system tray.
 
Let's assume you're talking about Z-order after you restore the windows state back. Again, would be a pointless Question. When you restore it normally using keyboard/mouse, it is by definition on top of Z-order. If you restore it somehow programmatically, it can be anything. Nothing to discuss right now. Try to sort it out be yourself, as this is your code — I'm pretty much sure it has nothing to do with WFP specific stuff. If you face a problem and report it in a sensible way, I would gladly help.
 
—SA
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Maybe it only puts it behind other IE/Explorer windows (same core process). Try it with Notepad and you may see that it only goes behind Notepad (which is correct behavior).
 
Losing the task-bar icon is weird, and is probably a different problem. Are you doing anything with the Window styles?
  Permalink  
Comments
Jibrohni at 28-Apr-11 4:37am
   
Nishant, I think you've better undertood my problem. But for more clarity I shall explain again.
 
Let's say I have 3 applications open, the topmost is Internet Explorer, second is my application, and thirdly is an Explorer window. So I wish to view my application by minimizing the IE window. For some reason this drops my application behind the Explorer window that was at the back to start with. I haven't even interacted with my application, but it's affected?
 
I agree that the icon issue is most likely something different. Now my application uses WindowStyle - SingleBorderWindow and implements a Glass Effect:
 
public static bool ExtendGlassFrame(Window window, Thickness margin)
{
if (IsGlassEnabled())
{
 
if (!DwmIsCompositionEnabled())
return false;
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == IntPtr.Zero)
throw new InvalidOperationException("The Window must be shown before extending glass.");
// Set the background to transparent from both the WPF and Win32 perspectives
window.Background = Brushes.Transparent;
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
MARGINS margins = new MARGINS(margin);
DwmExtendFrameIntoClientArea(hwnd, ref margins);
return true;
}
else
return false;
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 27 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100