6

私は WPF でプロジェクトを開発していますが、プロジェクトでポップアップ ウィンドウを使用して問題に直面しています。以下に示すように、ウィンドウでポップアップ コントロールを使用します。

<Popup HorizontalAlignment="Center" VerticalAlignment="Center" 
    AllowsTransparency="True" x:Name="popup" Placement="Center" 
    OpacityMask="#FFC86E6E" Closed="popup_Closed" >
    <Grid Height="auto" Width="auto" Margin="0" >
        <Grid.RowDefinitions>
            <RowDefinition Height="0.488*"/>
            <RowDefinition Height="0.512*"/>
        </Grid.RowDefinitions>

        <Frame x:Name="popupframe" Margin="0" Grid.Row="1"  />
        <Button Width="30" Height="30"  HorizontalAlignment="Right" 
                            Margin="0,0,10,-50" VerticalAlignment="Center" 
                            BorderThickness="0" BorderBrush="{x:Null}" 
                            ClickMode="Press" Click="Button_Click" 
                            Foreground="{x:Null}">
            <Button.Background>
                <ImageBrush ImageSource="Image/1329666144_button_cancel.png" Stretch="UniformToFill"/>
            </Button.Background>
        </Button>
            </Grid>
</Popup>

今、テキストボックスとボタンを使用してwpfで新しいページを作成し、このページを以下のポップアップフレームショーに設定します:-

popupframe.Content=new SessionObjection();

ページボタンでポップアップウィンドウを閉じたいと思います。どうすれば...

4

3 に答える 3

11

IsOpenプロパティを に設定すると、ポップアップを閉じることができますfalse

于 2012-08-18T12:43:04.727 に答える
5

あなたは試すことができます

private void btnClosePopup_Click(object sender, RoutedEventArgs e)
        {
            popup.IsOpen = false;
        }
于 2012-08-18T12:41:59.440 に答える