简体   繁体   English

调整主窗体调整大小(WPF,C#)

[英]Resize control on Main Form resize (WPF, C#)

I created a user control which is a Grid of TextBlocks with fixed height rows and fixed width each. 我创建了一个用户控件,它是一个TextBlocks的Grid,每个都有固定的高度行和固定的宽度。 I place this control on a main form. 我将此控件放在主窗体上。 Then on the run time I read current height of the control and based on this value I calculate number of rows to display. 然后在运行时我读取控件的当前高度,并根据此值计算要显示的行数。 Now, the problem is, when I resize main form: how can I update number of rows based on the new height of the main form? 现在,问题是,当我调整主窗体的大小时:如何根据主窗体的新高度更新行数?

edit: saying Grid of textblocks I meant a grid layout of texblocks 编辑:说文本块的网格我的意思是texblocks的网格布局

向Window.SizeChanged事件添加处理程序并在那里重新调整Grid的大小

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

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