C# 弹出控件没有';使用WPF中的.exe时无法打开,但在VS 2010中运行

C# 弹出控件没有';使用WPF中的.exe时无法打开,但在VS 2010中运行,c#,wpf,popup,exe,C#,Wpf,Popup,Exe,我的应用程序中有一个弹出窗口,通过更改组合框的选定值来激活。 当我在VS2010中调试时,它工作正常,但当我在同一台计算机上使用.exe时,它不会启动 在使用.exe时,是否应该使用弹出窗口的其他属性使其保持打开状态 private void trigger_mode_SelectionChanged(object sender, SelectionChangedEventArgs e) { MODE = trigger_mode.SelectedValue.ToStr

我的应用程序中有一个弹出窗口,通过更改组合框的选定值来激活。 当我在VS2010中调试时,它工作正常,但当我在同一台计算机上使用.exe时,它不会启动

在使用.exe时,是否应该使用弹出窗口的其他属性使其保持打开状态

 private void trigger_mode_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        MODE = trigger_mode.SelectedValue.ToString();
        switch (Convert.ToString(trigger_mode.SelectedValue))
        {
            case "triggerModeData":
                Popup_data.Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse;
                Popup_data.StaysOpen = false;
                Popup_data.Height = 200;
                Popup_data.Width = 250;
                Popup_data.IsOpen = true;
                break;

            case "triggerModeRepeat":
                Popup_repeat.Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse;
                Popup_repeat.StaysOpen = false;
                Popup_repeat.Height = 200;
                Popup_repeat.Width = 250;
                Popup_repeat.IsOpen = true;
                break;
        }
    }
XAML代码

 <Popup x:Name="Popup_repeat" AllowsTransparency="True">
        <StackPanel Background="BurlyWood">
            <TextBlock TextWrapping="Wrap" Name ="T1" Text="Please enter the time interval between triggers in milliseconds"/>
            <TextBox Name="T2" Text="Enter value here" KeyDown="T2_KeyDown"/>
            <TextBlock TextWrapping="Wrap">
                <TextBlock.Text>
                    Detail - In the trigger repeat the camera is triggered periodically with a specific time interval.
                    Please enter the time between each triggers in the textbox above by first deletign the line 'Enter value here'
                    and put the time interval value in milliseconds.
                </TextBlock.Text>
            </TextBlock>
        </StackPanel>
    </Popup>
    <Popup x:Name="Popup_data" AllowsTransparency="True">
        <StackPanel Background="BurlyWood">
            <TextBlock Name ="T3" TextWrapping="Wrap" Text="Please enter the time to wait after trigger in milliseconds."/>
            <TextBox Name="T4" Text="Enter value here" KeyDown="T4_KeyDown"/>
            <TextBlock TextWrapping="Wrap">
                <TextBlock.Text>
                    Detail - In the data trigger mode the camera waits a certain time after a mechanical pre-trigger and 
                    then sends a trigger to the camera to take a picture after that interval. If you are using this mode. 
                    Enter the time the camera has to wait after the trigger in teh textbox by first deleting the text 
                    'Enter value here' and thentype in the interval time in milliseconds"
                </TextBlock.Text>
            </TextBlock> 
        </StackPanel>
    </Popup>

细节-在触发重复中,相机以特定的时间间隔定期触发。
请首先删除“在此处输入值”行,在上面的文本框中输入每个触发器之间的时间
并将时间间隔值以毫秒为单位。
细节-在数据触发模式下,相机在机械预触发和
然后向相机发送一个触发器,在该间隔后拍摄照片。如果您正在使用此模式。
首先删除文本,在文本框中输入相机触发后必须等待的时间
“在此处输入值”,然后键入间隔时间(毫秒)

如果您需要弹出窗口保持打开状态以接收输入,则需要将
StaysOpen
属性设置为
True
。否则,一旦焦点或激活离开弹出窗口,弹出窗口将立即关闭。

您确定它根本没有打开吗?可能因为焦点更改而打开并立即关闭。请尝试更改de>StaysOpen到
True
以查看弹出窗口是否出现在正在运行的可执行文件中。我不知道焦点更改是什么,但我会尝试将StaysOpen更改为True。哦,我明白了,焦点更改是在调试从弹出窗口返回到mainwindow时,并且在每次调试操作后重新生成bin文件夹中的.exe文件,或者我是否必须执行其他操作才能保存对.exe中代码的任何更改?以下是有关WPF焦点的一些很好的阅读:,。我不确定是否遵循了您关于代码更改和.exe的问题。如果编译代码,它将使用所有当前代码并生成可执行文件。您可以在调试时使用“编辑并继续”进行更改,它将捕获这些更改se更改,但在将这些更改包括在已编译的可执行文件中之前,需要重新编译。