我如何只在UserControl上执行操作?

时间:2014-05-16 00:45:27

标签: windows-phone-8

我有一个UserControl:

<UserControl x:Class="WP8.Progress"
    ..................................
    d:DesignHeight="800" d:DesignWidth="480">
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Rectangle Stretch="Fill" Opacity="0.75" Fill="DarkGray"/>
        <StackPanel x:Name="stackPanel" Orientation="Vertical" VerticalAlignment="Center">
            <ProgressBar Foreground="Blue" IsIndeterminate="True"/>
        </StackPanel>
    </Grid>
</UserControl>

我在MainPage中调用UserControl:

<phone:PhoneApplicationPage
    x:Class="WP8.MainPage"
    ..................................
    mc:Ignorable="d"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <Grid x:Name="LayoutRoot" Background="Black">
        <Grid>
            <Button Name="btnButton" Content="OK" Click="btnButton_Click"/>
        </Grid>
        <Grid>
            <uc:Progress />
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>

当我运行应用程序时,我看到UserControl上部MainPage但我仍然按下主页上的按钮。 我如何只在UserControl上执行操作?

1 个答案:

答案 0 :(得分:0)

我得到了你的问题,当你打开UserControl设置你的LayoutRoot时,我已经在我的应用程序中做了同样的事情。设置你的LayoutRoot.IsHitTestVisible =&#34; False&#34;然后用户完成usercontrol或usercontrol关闭然后将其设置为true。如果您想使用网格,还可以进行一些不透明度或可见性更改。

相关问题