WPF辅助窗口快照主窗口

时间:2016-09-07 11:46:33

标签: c# wpf

WPF项目的MainWindow有多本书(在这种情况下只有一本)。

MainWindow

铅笔图标实际上是一个按钮,用于创建BookEdit窗口的新实例并显示它。单击它应该显示以下内容(并且它曾经这样做过)。

BookEdit

我的问题是,最近,辅助窗口开始对主窗口进行快照,并将其中的一部分显示为窗口的一部分:

Snapshot

并且即使我移动窗口它也会这样做:

Snapshot conservation

为什么会这样?这是我的GPU /什么的问题?我目前无法在其他设备上测试该软件。

我还从解决方案中删除了任何ZIndex。

编辑1:

应该注意的是,MainWindow的书籍是在使用Children.Add

后生成的
Button newbutt = new Button();
                newbutt.Background = null;
                newbutt.SetResourceReference(Control.StyleProperty, "BookToolbarButton");
                newbutt.Click += new RoutedEventHandler(FileHandler.editBook);
                Image pencil = new Image();
                pencil.Source = new BitmapImage(new Uri("pack://application:,,,/Images/pencil.png"));
                newbutt.Content = pencil;
                sp.Children.Add(newbutt);

editBook():

string name = (((sender as Button).Parent as StackPanel).Parent as Grid).Name;
        if (System.String.IsNullOrEmpty(name)) Console.WriteLine("Error: The book does not hold a ");
        else
        {
            Console.WriteLine("Editting book {0}", name);
            BookEdit bEdit = new BookEdit("books/" + name + ".json");
            bEdit.Show();
        }

0 个答案:

没有答案
相关问题