【发布时间】:2016-10-07 15:11:01
【问题描述】:
我正在 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();
现在我想用页面按钮关闭弹出窗口。我是怎么做到的……
【问题讨论】:
-
您能否澄清一下:
SessionObjection中的代码是否应该关闭弹出窗口?