0

我在 windows phone 中使用弹出窗口,当我打开一个弹出窗口时,弹出窗口打开并且弹出元素后面的页面可以访问,我有一个列表框,它可以滚动。

如果弹出窗口打开后面的控件应该是不可访问的,对吧?我怎样才能做到这一点,

这是我的代码

 Popup popup = new Popup();
                popup.Height = 300;
                popup.Width = 450;
                popup.VerticalOffset = 250;
                popup.HorizontalOffset = 20;
                notLogedInPopup control = new notLogedInPopup();
                popup.Child = control;
                popup.IsOpen = true;

这里是 notLogedInPopup 设计的代码,即 UserControl

<UserControl x:Class="offertimeline.notLogedInPopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="300" d:DesignWidth="450">

<UserControl.Resources>
    <Style x:Key="ButtonStyle1" TargetType="Button">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="Padding" Value="10,3,10,5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}">
                            <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

<Grid x:Name="LayoutRoot">
    <Grid.Background>
        <ImageBrush ImageSource="/offertimeline;component/images/listbg.png" />
    </Grid.Background>
    <Image Source="/offertimeline;component/images/filtertitlebg.png" Margin="0,-2,0,242" Name="bgImage" Stretch="Fill" />
    <Image Margin="9,5,0,255" Source="/offertimeline;component/images/alert_icon.png" Name="alertIconImage" Stretch="Fill" HorizontalAlignment="Left" Width="51" />
    <Button Style="{StaticResource ButtonStyle1}" BorderThickness="0" Margin="354,-2,13,241" Name="closeBtn" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" ManipulationCompleted="closeBtn_ManipulationCompleted" ManipulationDelta="closeBtn_ManipulationDelta" ManipulationStarted="closeBtn_ManipulationStarted">
        <Button.Background>
            <ImageBrush ImageSource="/offertimeline;component/images/filter_close.png" />
        </Button.Background>
    </Button>
    <TextBlock Margin="55,10,124,255" Text="Login Required" TextAlignment="Center" Foreground="Black" Name="titleTextBx" FontSize="24" />
    <TextBlock Height="89" HorizontalAlignment="Left" Margin="28,124,0,0" Name="contentTextBx" Text="Please login with your credentials to do this." VerticalAlignment="Top" Width="406"  Foreground="Gray" TextWrapping="Wrap" FontSize="22"  TextAlignment="Center" />
    <Button Style="{StaticResource ButtonStyle1}" Height="72" HorizontalAlignment="Left" Margin="131,240,0,0" Name="okBtn" VerticalAlignment="Top" Width="160" BorderThickness="0" BorderBrush="{x:Null}" Click="okBtn_Click" ManipulationCompleted="okBtn_ManipulationCompleted" ManipulationDelta="okBtn_ManipulationDelta" ManipulationStarted="okBtn_ManipulationStarted">
        <Button.Background>
            <ImageBrush ImageSource="/offertimeline;component/images/okbtn.png" />
        </Button.Background>
    </Button>
</Grid>

谢谢你。

4

0 回答 0