简体   繁体   English

在WPF MVVM中使用Caliburn Micro调整大小的中心窗口?

[英]Center Window on Resize using Caliburn Micro in WPF MVVM?

I am using Caliburn Micro, My UserControl(Window) is intially in Center Screen but as content loaded into it dynamically, its size increases. 我正在使用Caliburn Micro,我的UserControl(Window)最初位于中心屏幕中,但是随着内容动态加载到其中,其大小会增加。

So i want to make the window in Centre Screen when it resizes. 因此,我想在调整大小时在“中心屏幕”中创建窗口。

While I do not agree with the usability of moving a window in general, here is what you'd do to re-center your window if the window has been resized: 我通常不同意移动窗口的可用性,但是如果窗口已调整大小,则可以按照以下步骤重新放置窗口:

  1. Create a SizeChanged event handler. 创建一个SizeChanged事件处理程序。
  2. In the event handler, re-center the window 在事件处理程序中, 将窗口重新居中

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

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