1

我按照这个示例在 Coding4Fun MessagePrompt 中显示我的用户控件。 http://windowsphonegeek.com/articles/Creating-a-Windows-Phone-7-Trial-Application-Adding-Buy-Now-Functionality

当单击页面底部的主页图标时,我打开 MessagePromt,其中包含带有两个按钮的 UserControl,如下图所示。

但是由于某种原因,出现了这个浅白色的边框,我无法确定它是从哪里来的。

注意:我为我的 usercontorl 和其中的所有控件设置了透明边框和 0 粗细。我只想显示蓝色面板,没有白色边框,它的宽度是 300,就像它所看到的那样。

有人知道吗?

在此处输入图像描述

4

2 回答 2

2

我从apphub 论坛上的“Eric Fleck - Microsoft”那里得到了帮助。这是他的解决方案:

<phone:PhoneApplicationPage    
    ...    
    xmlns:c4f="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls">   

    <phone:PhoneApplicationPage.Resources>  
        <ControlTemplate x:Key="MsgPropmtNoBorder" TargetType="c4f:MessagePrompt">   
            <Grid VerticalAlignment="Stretch">   
                <Rectangle Fill="{StaticResource TransparentBrush}" />  

                <Border VerticalAlignment="Top"    
                        Margin="10"    
                        Background="{TemplateBinding Background}"    
                        BorderThickness="0"    
                        BorderBrush="{StaticResource PhoneForegroundBrush}">   

                    <StackPanel Margin="10">   
                        <TextBlock    
                                    Text="{TemplateBinding Title}"    
                                    Margin="0,-10,-25,10"    
                                    FontSize="30"    
                                    TextWrapping="Wrap" FontFamily="Segoe WP Light" />  
                        <ContentPresenter Content="{TemplateBinding Body}" />  
                        <StackPanel    
                                    Margin="0,10,0,0"  
                                    Name="actionButtonArea"  
                                    Orientation="Horizontal"  
                                    HorizontalAlignment="Center" />  
                    </StackPanel>  

                </Border>  
            </Grid>  

        </ControlTemplate>  
    </phone:PhoneApplicationPage.Resources>


        MessagePrompt prompt = new MessagePrompt();    
        prompt.Body = new WPUC();    
        prompt.ActionPopUpButtons.Clear();    
        prompt.Overlay = new SolidColorBrush(Color.FromArgb(155, 41, 41, 41));   
        prompt.Template = (ControlTemplate)this.Resources["MsgPropmtNoBorder"];   

        prompt.Show(); 

这是生成的弹出窗口: 在此处输入图像描述

于 2012-06-16T02:46:44.087 回答
0

我玩了一下 MessagePrompt 控件,它找不到任何方法来禁用或隐藏边框。这是 MessagePrompt 控件中的一种阴影效果,可提供类似弹出的外观。

但是,即使您无法删除它,您也可以通过将 MessagePrompt 的 Width 属性设置为等于您的实际蓝色 UserControl (在本例中为 300)来减少它的影响。

于 2012-06-15T11:28:06.153 回答