Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 关注Excel VSTO WPF应用程序_.net_Wpf_Excel_Vsto - Fatal编程技术网

.net 关注Excel VSTO WPF应用程序

.net 关注Excel VSTO WPF应用程序,.net,wpf,excel,vsto,.net,Wpf,Excel,Vsto,我在Excel VSTO加载项中托管WPF应用程序,它在加载时运行良好,但是在最小化WPF对话框后,似乎无法使用代码再次激活(聚焦)。 已尝试: this.Show(); this.Activate(); this.BringIntoView(); this.Focus(); 但是它们都不起作用。好的,我找到了某种解决方案: 在关闭时,我使用事件处理程序将其Visibly设置为Hidden: private void ClientOnClosing(object

我在Excel VSTO加载项中托管WPF应用程序,它在加载时运行良好,但是在最小化WPF对话框后,似乎无法使用代码再次激活(聚焦)。 已尝试:

    this.Show();
    this.Activate();
    this.BringIntoView();
    this.Focus();

但是它们都不起作用。

好的,我找到了某种解决方案: 在关闭时,我使用事件处理程序将其Visibly设置为Hidden:

private void ClientOnClosing(object sender, CancelEventArgs cancelEventArgs)
        {
            cancelEventArgs.Cancel = true;
            _client.Visibility = Visibility.Hidden;
        }
为了处理最小化的WPF应用程序,我将WindowsState设置为Normal:

public void ShowDialog()
        {
            if (this.WindowState == WindowState.Minimized)
                this.WindowState = WindowState.Normal;
            this.Show();
        } 
这似乎行得通