简体   繁体   English

WPF MDI-从XAML设置活动窗口

[英]WPF MDI - setting active Window from XAML

I'm working with a proprietary framework at the moment, which takes over the role of the standard WPF window manager to create a desktop-like effect. 目前,我正在使用一个专有框架,该框架将接管标准WPF窗口管理器的角色以创建类似桌面的效果。

In this framework, we can only work in XAML. 在此框架中,我们只能在XAML中工作。 And a request came to create a Visual Studio-like "Windows" menu that lists the active Windows and allows one of them to be brought forward. 要求创建一个类似于Visual Studio的“ Windows”菜单,该菜单列出了活动的Windows并允许其中之一被转发。

However I'm having some issues with the second half. 但是下半场我有一些问题。 I've tried binding the MenuItems IsChecked property to the Window objects Topmost property, but as WPF allows multiple windows to be topmost, it does not work perfectly. 我尝试将MenuItems IsChecked属性绑定到Window对象的Topmost属性,但是由于WPF允许多个窗口位于最高位置,所以它不能完美地工作。 Unfortunately we cannot add code behind, as it is all managed by the framework. 不幸的是,我们无法在其后添加代码,因为它们全部由框架管理。

Is there any solution for doing the window switching part without any code? 有没有任何代码来执行窗口切换部分的解决方案?

There is Zindex property which is widely used in terms of bringing any window or control at the top. Zindex属性广泛用于将任何窗口或控件置于顶部。 if you have say multiple window or multiple controls withing a window set some value of zindex , it will put the window or control at the top which has the highest zindex value. 如果您说多个窗口或带有一个窗口的多个控件设置了一些zindex值,它将把具有最高zindex值的窗口或控件放在顶部。 Try setting zindex value from xamal to bring forth the window you need, using trigger you can set it's value on clicking the menu you have created 尝试从xamal设置zindex值以显示所需的窗口,使用触发器可以在单击创建的菜单时设置其值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM