Is there a method on the pane (or its group or container?) to make a window pop to the top of the z order?
Thanks
7 Answers, 1 is accepted
var
pane = this.FindName(paneName) as RadPane;
(update...)
I saw from another post in this forum how to do the find, but I still have the OP's issue about bringing the desired floating window to the front. I now find the pane using var pane = DockingRoot.Panes.Where(p => p.Name == paneName).FirstOrDefault();
public
void
ShowPaneForExistingWorkitem(
int
workitemId)
{
var paneName =
"Pane__workitem "
+ workitemId.ToString();
var pane = DockingRoot.Panes.Where(p => p.Name == paneName).FirstOrDefault();
if
(pane !=
null
)
{
if
(pane.IsFloating)
{
var tw = pane.ParentOfType<ToolWindow>();
if
(tw !=
null
)
{
tw.BringToFront();
tw.Focus();
}
}
else
{
var parentPaneGroup = pane.Parent
as
RadPaneGroup;
if
(parentPaneGroup !=
null
)
parentPaneGroup.SelectedItem = pane;
}
}
else
{
pane =
new
RadPane {Name = paneName, Title = paneName, CanFloat =
true
};
var workitemEditor =
new
PaneWorkitemEdit();
MainDockingPaneGroup.Items.Add(pane);
pane.Content = workitemEditor;
workitemEditor.workitemId = workitemId;
}
}
}
I put this into a helper function. You could obviously make it an extension method too.
Cheers.
public void BringPaneToTop(RadPane pane)
{
if (pane != null)
{
if (pane.IsFloating)
{
var tw = pane.ParentOfType<
ToolWindow
>();
if (tw != null)
{
tw.BringToFront();
tw.Focus();
}
}
else
{
var parentPaneGroup = pane.Parent as RadPaneGroup;
if (parentPaneGroup != null)
parentPaneGroup.SelectedItem = pane;
}
}
}
What I would suggest you is to use the ActivePane API we added in the 2011 Q2 release. What you need to do is just to set the ActivePane to be the one you want to bring to the front.
One more thing - ParentOfType<ToolWindow>() will not always help you to find the Window that hosts the pane (for example if the Pane is hidden). A better way to find it is to call the GetParentToolWindow extension method of the RadPane, RadPaneGroup and RadSplitContainer classes.
Miroslav Nedyalkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
Good tip on the GetParentToolWindow() extension method.
I've tried setting the ActivePane on the dock control, and it did not bring floating windows to the top. It only worked if the panes were docked and/or pinned. The workaround David proposed seemed to do the trick.
Mike
It looks like a bug in the ActivePane functionality that we will be targeting. Once the fix is ready you will be able to remove the work-around.
Greetings,Miroslav Nedyalkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
I took the proposed code, incorporated the moderator's suggestion, and added the highlighted code to get the following (complying with some of our coding style guidelines):
private
void
BringPaneToTop(RadPane radPane)
{
if
(radPane !=
null
)
{
if
(radPane.IsFloating)
{
ToolWindow toolWindow = radPane.GetParentToolWindow();
if
(toolWindow !=
null
)
{
toolWindow.BringToFront();
toolWindow.Focus();
RadPaneGroup parentRadPaneGroup = radPane.Parent
as
RadPaneGroup;
if
(parentRadPaneGroup !=
null
)
{
parentRadPaneGroup.SelectedItem = radPane;
}
}
}
else
{
RadPaneGroup parentRadPaneGroup = radPane.Parent
as
RadPaneGroup;
if
(parentRadPaneGroup !=
null
)
{
parentRadPaneGroup.SelectedItem = radPane;
}
}
}