简体   繁体   English

WPF棱镜自定义弹出窗口未调整为内容大小

[英]WPF prism Custom popup not resizing to content

I was following this example on how to create and raise custom popup(so i won't add code because of its basically a clone of that example) 我一直在关注示例,了解如何创建和引发自定义弹出窗口(因此,我不会添加代码,因为它基本上是该示例的克隆)

The only thing i changes is i added a TextBox 我唯一改变的是我添加了一个TextBox

<TextBox Text="{Binding Count}"  />

so i can control the amount of asterisk in the Content of the popup 这样我就可以在弹出窗口的Content中控制星号的数量

Basically, I have 2 problems: 基本上,我有两个问题:

  • The first one is that the title is cut off (this is with 1 asterisk) 第一个是标题被切除(带有一个星号)

在此处输入图片说明

  • And the second one is that if i change the content and raise the pop again it does not change the size to fit the content(this is with 50 asterisks) 第二个是,如果我更改内容并再次弹出,则它不会更改大小以适合内容(带有50个星号)

在此处输入图片说明

but i re-start the program and send 50 asterisks it does fit to fill all those asterisks 但我重新启动该程序并发送50个星号,它确实适合填满所有这些星号 在此处输入图片说明

Is there any way to achieve this besides measuring the text width 除了测量文字宽度外,还有什么方法可以做到这一点

I have the same problem. 我也有同样的问题。 The prism popup-window, once created to contentsize, does not resize when content changes. 棱镜弹出窗口一旦创建为contentsize,则在内容更改时不会调整大小。 I am sure that I have all done everything correct with respect to: BindableBase inheritence, and SetProperty calls. 我确信我已经完成了以下所有正确的事情:BindableBase继承和SetProperty调用。 But once created (and the window gets created once) no resizing takes place. 但是一旦创建(窗口创建一次),就不会进行大小调整。

I have no solution (other than take over the calculation of the window-size). 我没有解决方案(除了负责计算窗口大小)。 What I need is a call to force the popup window to (re)resize to new content, somehow. 我需要的是以某种方式强制将弹出窗口调整为新内容的大小的调用。

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

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