I created custom window with WindowStyle=none and AllowTransparency=True. Then I create graphic for window and add codebehind. It is pretty easy and it is working as classic not customized window. But problem arise when I want shadow, because shadows can be done as workaround and not as true shadows which cast window. But maybe I am not aware of how to add shadows to the window.
Problem:
Here is how I add shadow to the window. I create Rectangle which cover full window graphic area and is behind everything. This Rectangle cast shadow. But problem is, shadow is not displayed because everything outside window is cliped, or not drawed. Therefore I must use margin, which create empty space between window borders and graphics.
But new problems arise, resizeing to the fullscreen is not correct visually (because the empty space ). If I try modify position and size window when window is Maximized, for some odd reason, window can't add more height then WorkArea, even if I set Height more then Screen Height. But for width it is not problem. The solution is turn off margin. But problem is solved partialy.
When I position window in to Top-Left, similar to WindowsExplorer, it should be automaticly resized to the like full screen but only with half width. Similar when I put window Top-Right. This is working, but there is problem with the empty space and I am not able get WindowState, because there is only 3 WindowStates (Minimize, Maximize, Restore).
Another problem is, if I move window little above top screen, and stop moving, window is jumped to the few px down because window graphic (inside window) is with this empty space around (for shadows), but technicaly it is correct, but visually it is unwanted because window graphic have margin. This is same behvaior for Window Explorer, but Window Explorer doesn't have empty space around window graphic.
Questions:
1. from Problem described above and Window shadow technique, can WPF window set "window behavior area" in to WPF UI Element like grid? I mean when window will be maximized, it will take grid area not window area, or if I change window position above top screen it will take grid area not window area. I hope you will understand what I am talking about, if not please ask and I try describe it more.
2. If question 1. is not possible, Can I add shadows to the window without WPF shadows? I call it native windows shadow. Maybe it will be better solution because user can turn off shadows on windows and they will be turned inside my application window too, but this can be done with WPF shadows (turn on/off) too.