所以我有这个简单的python代码
if (VisualTreeHelper.GetParent(this) is ContentPresenter contentPresenter)
{
if (VisualTreeHelper.GetParent(contentPresenter) is RingsStackpanel ringStackPanel
&& RingHolder.ItemsSource is ObservableCollection<YourItemType> dataItems
&& contentPresenter.DataContext is YourItemType dataItem)
{
//wait for the ContentPresenter to get unloaded
RoutedEventHandler handler = null;
handler = (ss, ee) =>
{
//remove the parent-child relationship:
ringStackPanel.RemoveElement(contentPresenter);
contentPresenter.Unloaded -= handler;
};
//remove the data object
dataItems.Remove(dataItem);
}
}
由于某种原因,我将其打印出来
1.7320508075688772
2.23606797749979
2.6457513110645907
3.0
它也打开了这个pyplot https://i.imgur.com/lHi3X2y.png
当关闭图像时,它会打印出实际的df.head,而且
[5行x 12列]
这不可能发生,所以我非常困惑。