How to remove the border in Coding4Fun MessagePrompt

爷,独闯天下 提交于 2019-12-01 10:58:18

问题


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

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.

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.

Does any one has any idea?


回答1:


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:




回答2:


I played a bit with the MessagePrompt control, it couldn't found any way to disable or hide the border. It's a shadow kind of effect in MessagePrompt control to provide a popup like appearance.

However, Eventhough you cannot remove it, you can reduce it's effect by setting the Width property of the MessagePrompt equal to your actual blue UserControl ( 300 in this case).



来源:https://stackoverflow.com/questions/11044946/how-to-remove-the-border-in-coding4fun-messageprompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!