silverLight childWindow

2019-02-26 05:20发布

问题:

how can i do my childWindow to be always on top?

回答1:

If by ChildWindows you mean the ChildWindow object in Silverlight then it should always appear on top, as the documentation says:

A ChildWindow always displays in a modal popup that blocks user interaction with the underlying user interface.

But if by ChildWindow you mean something else you created in Silverlight then you need to set the ZIndex property of that object to a very big number:

The z-order of an object determines whether the object is in front of or behind another overlapping object. By default, the z-order of objects within a Panel is determined by the sequence in which they are declared. Objects that are declared later appear in front of objects that are declared earlier. You can change this behavior by setting the Canvas..::.ZIndex attached property on objects within the Panel. Higher values are closer to the foreground; lower values are farther from the foreground.

In codebehind you would write:

myObject.SetValue(Canvas.ZIndexProperty, 100); 

and in XAML you would need to write

<Rectangle Canvas.ZIndex="100" />


回答2:

Maybe Popup control will help you? http://jesseliberty.com//2008/06/06/popup-control/