1

在我的 Windows 应用商店应用程序(c#)中,我有弹出窗口:

<Popup x:Name="LoginPopup" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Height="300" IsOpen="{Binding Path=LoginPopupIsOpen}">
            <Popup.ChildTransitions>
                <TransitionCollection>
                    <PopupThemeTransition />
                </TransitionCollection>
            </Popup.ChildTransitions>
</Popup>

当 Popup IsOpen 时,我只需要在 Popup 上处理事件并冻结所有其他 UI(包括 AppBar)。
可以不创建工作区很小的全屏弹出窗口吗?

4

3 回答 3

0

您可以使用两个属性在 xaml.cs 文件中执行此操作。在您正在创建的弹出窗口的事件处理程序中,您可以包含以下两行

this.IsEnabled = false;
this.ApplicationBar.IsVisible = false;

在要关闭弹出窗口的事件处理程序中,您可以将属性恢复为其原始值。

this.IsEnabled = true;
this.ApplicationBar.IsVisible = true;
于 2014-03-10T12:06:39.730 回答
0

我使用下面的代码制作了小弹出窗口。请试试这个。

<Grid Background="Black" Opacity="0.7"  Visibility="Collapsed" x:Name="gdalert" Height="{Binding Height, ElementName=gdfullpage}" Width="{Binding Width, ElementName=gdfullpage}">
            <Popup x:Name="settingpopup"  Width="350" Grid.Row="1"  HorizontalAlignment="Center" VerticalAlignment="Center">
                <Border x:Name="settingbdrmain"  Grid.Row="1"  BorderThickness="0"  Width="350"  CornerRadius="15" >
                    <Grid x:Name="gdsubshape" Margin="0,10,0,10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="0,0,0,0" Grid.Row="0" x:Name="dddf" FontSize="20" Text="" HorizontalAlignment="Center" TextAlignment="Center"  FontFamily="Arial" FontWeight="Bold" TextWrapping="Wrap" ></TextBlock>
<TextBlock x:Name="txtsettingalert"  Text="" FontSize="20" TextAlignment="Center" Width="300" FontFamily="Arial"   TextWrapping="Wrap"  Foreground="Black" Grid.Row="1" ></TextBlock>
                        <Border x:Name="settingbdr" Width="350" Grid.Row="2" Height="1" Background="Red" BorderBrush="Black" >
                        </Border>
                        <Grid x:Name="btnpanel" Grid.Row="3" Height="60">
                            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                 <ColumnDefinition Width="Auto">/ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Button x:Name="settingok"   Grid.Column="0"  Height="50"  HorizontalAlignment="Left"VerticalAlignment="Center" MinHeight="20"  Width="170" Content="OK" FontSize="24" Foreground="Green" ></Button>
                            <Border  x:Name="settingsubbdr"  Grid.Column="1" BorderBrush="Green" Height="Auto" Width="1" ></Border>
                            <Button x:Name="sl" Grid.Column="2"  Height="50"  HorizontalAlignment="Right" VerticalAlignment="Center" MinHeight="20"  Width="170" Content="Cancel" FontSize="24" Foreground="Green" ></Button>
                        </Grid>
                    </Grid>
                </Border>
            </Popup>

打开使用:- popname.IsOpen = true; gdalert.Visibility = Visibility.Visible;

关闭 popname.IsOpen = false; gdalert.Visibility = Visibility.Collapse;

于 2017-07-28T13:31:32.900 回答
0

我也面临类似的问题,并用它来处理。

        private void AlertMessage_Opened(object sender, object e)
    {
        UIBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
    }

    private void AlertMessage_Closed(object sender, object e)
    {
        UIBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
    }

我的弹出窗口名称是 AlertMessage,我用它攻击打开和关闭的事件,并在 xaml 中放置一个覆盖整个屏幕的边框,并且通过这些事件处理可见性。

    <Border Name="UIBlock" Grid.Row="0" Grid.RowSpan="3" Background="#AAFFFFFF" Visibility="Collapsed">
    </Border>

并记住在弹出之前放置此边框

于 2015-09-30T10:09:00.427 回答