I'm developing a WPF control that contains a popup.
我正在开发一个包含弹出窗口的WPF控件。
The popup is placed relatively to an element that is draggable. This element can be positioned around the edges of the screen. So every time I open the popup I need to determine whether it will fit on the screen or it will be automatically repositioned.
弹出窗口相对于可拖动的元素放置。该元素可以位于屏幕边缘周围。因此,每次打开弹出窗口时,我都需要确定它是否适合屏幕,否则它将自动重新定位。
How can I achieve this?
我怎样才能做到这一点?
1 个解决方案
#1
0
It is possible to centre a pop-up for example in the middle of your screen. Based on what you typed and on your tags I assume you need XAML to center a popupscreen.
例如,可以在屏幕中间居中显示弹出窗口。根据您输入的内容和标签,我假设您需要XAML来固定弹出屏幕。
you can do it like this: <Popup x:Name="ParentPopup" PlacementTarget="{Binding ElementName=MainPanel}" Placement="Center" />
你可以这样做:
#1
0
It is possible to centre a pop-up for example in the middle of your screen. Based on what you typed and on your tags I assume you need XAML to center a popupscreen.
例如,可以在屏幕中间居中显示弹出窗口。根据您输入的内容和标签,我假设您需要XAML来固定弹出屏幕。
you can do it like this: <Popup x:Name="ParentPopup" PlacementTarget="{Binding ElementName=MainPanel}" Placement="Center" />
你可以这样做: