I am creating a custom UI including Window elements (title bar, menubar, borders) I have a custom class CustomWindow which is a subclass of Window.
To add custom window elements I am doing it by code, say in the Opening event of the CustomWindow Class
Var myBorder As New CustomWindowBorder
myBorder.Left = 0
myBorder.Top = 0
myBorder.Width = Me.Width
myBorder.Height = Me.Height
#... keep initializing the border
Me.Add(myBorder)
myBorder.Refresh()
The issue I have is the border canvas is placed overtop all the control placed in the designer and now that transparent pixels are not ignored by Mouse Events, the border canvas consumes all mouse events making the window controls unreachable. I can get around this by adding individual left,top,right,bottom borders but its not as elegant.
I am wondering if there could be a way to manage z order at runtime, it seems designer controls are initialized before the opening event, so anything I do in opening is going to be on top of the designer controls. I was hoping that removing Window1 as the default window and then initializing it in App.Opening would somehow swap the order of operations but of course it doesn't.
The only other option I can think of is to build my entire UI in code but that is very tedious and 100% removes the benefit of a visual designer (its already hard enough with canvases, I somewhat get around this by generating default control state images and putting them in as backdrops for controls)