c# - WP7 中带有图像的消息框

标签 c# .net silverlight windows-phone-7

嗨,目前我正在使用带有图像和两个按钮的网格来在我的 WP7 应用程序中显示自定义消息框,其可见性首先折叠。一切工作正常,但当其可见性可见时,我必须禁用页面后面的所有控件。因此,启用/禁用后面的大量控制是相当大的开销。

对于我的要求有更好的解决方案吗:(1)显示一个包含图像和两个按钮或文本框的消息框,(2)它应该出现在页面中间。

提前致谢!!

最佳答案

您可以使用内置Popup control具有由 Kent Boogaart 编写的附加行为,因此它的行为类似于带有 PlacementTargetPlacement 的 WPF Popup 控件:

<Popup b:PopupPlacement.PlacementTarget="{Binding ElementName=someElement}">
    <b:Popup.PreferredOrientations>
        <b:PopupOrientationCollection>
            <b:PopupOrientation Placement="Top" HorizontalAlignment="Center"/>
            <b:PopupOrientation Placement="Bottom" HorizontalAlignment="Center"/>
            <b:PopupOrientation Placement="Right" VerticalAlignment="Center"/>
            <b:PopupOrientation Placement="Right" VerticalAlignment="TopCenter"/>
        </b:PopupOrientationCollection>
    </b:Popup.PreferredOrientations>

    <Grid>
       <Grid.RowDefinitions>
         <RowDefinition />
         <RowDefinition />
       </Grid.RowDefinitions>

       <TextBlock Grid.Row="0">My popup's contents</TextBlock>
       <Image Grid.Row="1" .... />
    </Grid>
</Popup>

关于c# - WP7 中带有图像的消息框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7792620/

相关文章:

c# - SilverLight - 一种查找导致模型更新的属性的方法

c# - Silverlight 中的 URI 相对资源

c# - 在 C# 中检测 Windows 10 主题更改

c# - 将未知数量的输入元素绑定(bind)到 MVC5 中的模型

c# - RSA .NET 加密 Java 解密

C#.NET Autocad 2021 API : Accessing specific BlockTableRecords within a given BlockTable?

c# - 无需正则表达式即可访问 Azure 容器的 Blob 名称

c# - .NET UDP 套接字发送增加内存使用

c# - .Net Core 3.1.2 中的 GetFullPath 行为与 .Net 4.6.1 不同

visual-studio-2008 - 在 XAML 中创建具有代码完成功能的属性或 DependencyProperties