This is a migrated thread and some comments may be shown as answers.

Let a UserControl stay in front of all Windows

3 Answers 130 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christoph
Top achievements
Rank 1
Christoph asked on 20 Mar 2011, 09:03 PM
Hi @ all,
i am developing a UI that looks like the windows-os ui. For the windows i am using the telerik  controls. My problem is, that my TaksList-Control (a normal Silverlight-UserControl) is also covered by the telerik-windows, because the telerik-windows stay on top of all usercontrols. 

My question is, if it is possible to let a control stay in top of the telerik-windows ?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 24 Mar 2011, 10:02 AM
Hello Christoph,

You are right - RadWindow always stays on top of the other controls. I suggest to modify your TasksList user control to inherit RadWindow class as explained in this help article - in this way you can set it to be above the other window. Please try it and let us know how it goes.

Best wishes,
Yana
the Telerik team
0
Christoph
Top achievements
Rank 1
answered on 05 Apr 2011, 06:41 PM
Hello Yana,

thank for your tip, but the problem is, that i have a lot of UIElements that must stay in front of all windows. It's not possible for me to implement them all as RadWindows. That would kill my visual application design.

I've reflekted the code that's executed during opening a RadWindow and i found the part, that is responsible fot let the RadWindows stay in Front of all other UIElements.

Here's the code:

internal static void AttachPopupToVisualTree(Popup popup)
{
    UIElement root = Application.Current.RootVisual;
    if (root != null)
    {
        Panel panel = root as Panel;
        if (panel == null)
        {
            int childrenCount = VisualTreeHelper.GetChildrenCount(root);
            for (int i = 0; i < childrenCount; i++)
            {
                panel = VisualTreeHelper.GetChild(root, i) as Panel;
                if (panel != null)
                {
                    break;
                }
            }
        }
        if ((panel != null) && (popup != null))
        {
            DependencyObject visualParent = VisualTreeHelper.GetParent(popup);
            DependencyObject logicalParent = popup.Parent;
            if ((visualParent == null) && (logicalParent == null))
            {
                panel.Children.Insert(0, popup);
                popup.UpdateLayout();
            }
        }
    }
}

            


You see, the problem is, that the Root-Panel for the RasWindows is autmaticaly set to the Application.Current.RootVisual (or the first Panel found in the visual-tree). 
Ist it possible to set the Root-Panel for the RadWindows manualy?
That would salve all my problems.

Thnaks!
0
Yana
Telerik team
answered on 07 Apr 2011, 04:16 PM
Hello Christoph,
 
This behavior of RadWindow is by design and cannot be changed - the window acts as a popup, that's why it is always shown on top. We're sorry for the inconvenience.

All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
Christoph
Top achievements
Rank 1
Answers by
Yana
Telerik team
Christoph
Top achievements
Rank 1
Share this question
or