C# windows phone页面提示上的透明前景?

C# windows phone页面提示上的透明前景?,c#,xaml,windows-phone,C#,Xaml,Windows Phone,我有一个带有stackpanel和网格的windows phone页面,其中包含设计页面的元素。 我还想在stackpanel和网格上放置一个透明图像,但它仍然应该显示,我该怎么做?如果我理解正确,您希望图像覆盖普通控件,背景部分透明,我只需将网格中最后一个图像与边框元素一起添加,它控制背景色和透明度,这将产生如下XAML页面: <phone:PhoneApplicationPage x:Class="PhoneApp1.MainPage" xmlns="http://sc

我有一个带有stackpanel和网格的windows phone页面,其中包含设计页面的元素。
我还想在stackpanel和网格上放置一个透明图像,但它仍然应该显示,我该怎么做?

如果我理解正确,您希望图像覆盖普通控件,背景部分透明,我只需将网格中最后一个图像与边框元素一起添加,它控制背景色和透明度,这将产生如下XAML页面:

<phone:PhoneApplicationPage
    x:Class="PhoneApp1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="MY AWESOME APP" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
            <TextBlock Text="a page" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <StackPanel>
                <TextBlock Text="Donec tristique leo eu dapibus volutpat. Pellentesque posuere, mauris nec suscipit mollis, purus ante dignissim dolor, a rhoncus tellus diam eu ligula. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus eget enim velit. Sed ut tincidunt nisi, at dictum velit. Donec in dapibus turpis. Ut dictum, leo sed accumsan sodales, purus nulla mollis odio, ac molestie elit ante sed lectus." Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" />
                <Button Content="A button" />
            </StackPanel>
        </Grid>

        <Grid Grid.RowSpan="2" IsHitTestVisible="False">
            <Border Background="Black" Opacity="0.75" />
            <Image Source="/Assets/my-overlay-image.png" />
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>

请注意,通过设置
ishitestvisible=“False”
图像后面的控件仍然可以单击

并给出以下结果:


您的意思是显示透明的图像吗?是的,在包含元素的windows phone页面上显示。如果您的图像是透明的,我不能让它可见。你想做一个不透明的面具吗?可以添加不透明度的边框,而不是图像。或者添加不透明度可见的图像。