I am writing an application that allows a user to add many docks to the same page at once. Currently, when a dock is added, it is placed "in front" of all the previous docks so that if more than one occupy the same screen area, the last one added will be in front of all the others.
I'm looking for a way to set the order of these docks so that the user can choose which docks are in front and in back. The functionallity I'm looking for can be thought of as a kind of "bring to front, send to back" type functionallilty seen in many programs.
I've played around with setting the z-index and that works fine when creating a dock in a CreateRadDock() Function using the following code.
dock.Style("z-index") = "1000" |
This same code also works in a dock command to set the z-index to a higher or lower number depending on the command.
The problem comes on postback when running CreateRadDockFromState(). Apparently the dock state doesnt store the front to back order of the docks. Or at least I cant see it if it does. So I have no way of determining the current value of z-index for the dock being created from a previous state.
Are there any suggestions or code samples to accomplish this? Here is my relavant code:
Private Function CreateRadDock() As RadDock |
Dim docksCount As Integer = CurrentDockStates.Count |
Dim dock As New RadDock() |
dock.Left = LeftPane.Width.Value - (Width / 2) + (ContentPane.Width.Value / 2) |
dock.Top = ContentPane.Height.Value / 4 |
dock.Attributes.Add("onclick", "onDockClick(this);") |
dock.Resizable = True |
dock.Style("z-index") = "1000" |
'dock.DockMode = DockMode.Floating |
dock.UniqueName = Guid.NewGuid().ToString() |
dock.ID = String.Format("RadDock{0}", dock.UniqueName) |
dock.Text = String.Format("Added at {0}", DateTime.Now) |
dock.OnClientResizeEnd = "onDockResizeEnd" |
dock.OnClientDragEnd = "onDockClientDragEnd" |
dock.OnClientCommand = "onDockCommand" |
Dim cmdSendToBack As New DockCommand |
cmdSendToBack.Name = "SendToBack" |
cmdSendToBack.Text = "Send To Back" |
cmdSendToBack.AutoPostBack = True |
dock.Commands.Add(cmdSendToBack) |
AddHandler dock.Command, AddressOf dock_Command |
Return dock |
End Function |
Private Function CreateRadDockFromState(ByVal state As DockState) As RadDock |
Dim dock As New RadDock() |
dock.ID = String.Format("RadDock{0}", state.UniqueName) |
dock.Attributes.Add("onclick", "onDockClick(this);") |
dock.ApplyState(state) |
dockdock.Text = dock.UniqueName |
AddHandler dock.Command, AddressOf dock_Command |
dock.OnClientResizeEnd = "onDockResizeEnd" |
dock.OnClientDragEnd = "onDockClientDragEnd" |
dock.OnClientCommand = "onDockCommand" |
Dim cmdSendToBack As New DockCommand |
cmdSendToBack.Name = "SendToBack" |
cmdSendToBack.Text = "Send To Back" |
cmdSendToBack.AutoPostBack = True |
dock.Commands.Add(cmdSendToBack) |
Return dock |
End Function |
Sub dock_Command(ByVal sender As Object, ByVal e As DockCommandEventArgs) |
Select Case e.Command.Text |
Case "Send To Back" |
Dim myDock As RadDock = DirectCast(sender, RadDock) |
myDock.Style("z-index") = "500" |
End Select |
End Sub |