Category / Section
How to move NativeFloatWindows behind the RibbonWindow while opening its Backstage?
You can move the NativeFloatWindow behind the Ribbonwindow while opening its Backstage. This can be achieved by,
- Setting the owner property of the Nativefloatwindow as Null.
- Setting the Topmost for the Ribbonwindow as true in the backstage opening event, and
- Resetting the owner and the Topmost properties of the Window on the Backstage closing event of the Ribbon.
The same is explained in the following code example.
XAML
<syncfusion:RibbonWindow x:Class="TopMostWpf.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" syncfusion:SkinStorage.VisualStyle="Office2013" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="*"></RowDefinition> </Grid.RowDefinitions> <syncfusion:Ribbon Name="m_ribbon"> <syncfusion:Ribbon.BackStage> <syncfusion:Backstage> </syncfusion:Backstage> </syncfusion:Ribbon.BackStage> </syncfusion:Ribbon> <syncfusion:DockingManager Grid.Row="1" UseNativeFloatWindow="True" > <ContentControl syncfusion:DockingManager.Header="ToolBox"> </ContentControl> <ContentControl syncfusion:DockingManager.Header="Output"> </ContentControl> </syncfusion:DockingManager> </Grid> </syncfusion:RibbonWindow>
C#
using Syncfusion.Windows.Tools.Controls;
namespace TopMostWpf
{
/// <summary>
/// Interaction logic for MainWindow.xaml.
/// </summary>
public partial class MainWindow : RibbonWindow
{
public MainWindow()
{
InitializeComponent();
m_ribbon.BackStageOpening += new System.ComponentModel.CancelEventHandler(m_ribbon_BackStageOpening);
m_ribbon.BackStageClosing += new System.ComponentModel.CancelEventHandler(m_ribbon_BackStageClosing);
}
//Method for BackstageOpening event.
void m_ribbon_BackStageOpening(object sender, System.ComponentModel.CancelEventArgs e)
{
foreach (Window w in Application.Current.Windows)
{
if (w is NativeFloatWindow)
//Sets the NativeFloatwindow owner to null.
w.Owner = null;
}
//Sets the TopMost for the RibbonWindow to true.
this.Topmost = true;
}
//Method for BackstageClosing event.
void m_ribbon_BackStageClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
foreach (Window w in Application.Current.Windows)
{
if (w is NativeFloatWindow)
//Resets the owner for the NativeFloatwindow.
w.Owner = this;
}
//Sets the TopMost for the RibbonWindow to false.
this.Topmost = false;
}
}
The following screenshot shows the backstage of the Ribbon window at the top position.
|
