将用户控件扩展到完整的窗口大小 [英] Expand Usercontrol to full window size

查看:36
本文介绍了将用户控件扩展到完整的窗口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个项目,该项目有一个选项卡控件,其中包含一个包含一系列用户控件的 Wrap 面板.我正在寻找一种方法,允许用户选择一个用户控件并将其最大化到选项卡控件/窗口的大小.

I am currently working on a project which has a tab control which contains a Wrap panel which contain a series of user controls. I am looking for a way to allow the user to select one user control and maximize it to the size of the tab control/window.

一个想法是简单地从面板中删除所有其他项目.但是我正在尝试尽可能多地使用 MVVM,我不确定用户控件应该了解多少面板.(用户控件将包含一个允许最大化的按钮)

One thought is to simply remove all the other items from the panel.However I am attempting to use MVVM as much as possible and I'm not sure how much the user control should know about the panel. (The user control will contain a button to allow maximizing)

有没有办法暂时从网格中删除用户控件并将其视为模态弹出窗口或只是填充窗口?

Is there a way to temporarily remove the usercontrol from the grid and treat it like a modal popup or just to fill the window?

推荐答案

如何在视图模型中拥有Visible"或Maximized"布尔属性对于每个基于用户控件的项目,并将所述用户控件的可见性属性数据绑定到适当的属性.然后将您的用户控件最大化/恢复按钮绑定到视图模型中的命令以适当地更改 VM 属性?

How about having "Visible" or "Maximized" bool properties in the view model for each user control based item, and databind said user controls Visibility property to the appropriate property. Then bind your user controls maximize/restore button to command in the view model to change the VM properties appropriately?

这篇关于将用户控件扩展到完整的窗口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆