如何在 Coding4Fun MessagePrompt 中去除边框 [英] How to remove the border in Coding4Fun MessagePrompt

查看:30
本文介绍了如何在 Coding4Fun MessagePrompt 中去除边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I followed this example to display my usercontrol inside Coding4Fun MessagePrompt. http://windowsphonegeek.com/articles/Creating-a-Windows-Phone-7-Trial-Application-Adding-Buy-Now-Functionality

当点击页面底部的主页图标时,我打开 MessagePromt,它有我的 UserControl 和两个按钮,如下图所示.

When the Home icon at the bottom of the page is clicked I open MessagePromt which has my UserControl with two buttons as shown in image below.

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

But for some reason there appears this light white border, I am unable to determine from where it is coming.

注意:我已经为我的 usercontorl 和其中的所有控件设置了边框透明和 0 厚度.我只想显示蓝色面板,没有白色边框,它的宽度为 300,正如所见.

Note: I have set border Transparent and 0 thickness for my usercontorl and all controls inside it. I just want to show the blue panel and no white border and it's width is 300 as what it is seen.

有人知道吗?

推荐答案

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

I got help from "Eric Fleck - Microsoft" on apphub forums. Here's his solution:

<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(); 

这是由此产生的弹出窗口:

Here's the resultant popup:

这篇关于如何在 Coding4Fun MessagePrompt 中去除边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆