从WPF使用.exe但在VS 2010中运行时,弹出控件不会打开

时间:2012-08-09 17:43:57

标签: c# wpf popup exe

我的应用程序中有一个弹出窗口,它由组合框的选定值的更改激活。 我在VS 2010中调试时工作正常,但是当我在同一台计算机上使用.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>

1 个答案:

答案 0 :(得分:0)

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