How to remove the border in Coding4Fun MessagePrompt

前端 未结 2 778
[愿得一人]
[愿得一人] 2021-01-15 18:15

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

相关标签:
2条回答
  • 2021-01-15 18:44

    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: enter image description here

    0 讨论(0)
  • 2021-01-15 18:45

    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).

    0 讨论(0)
提交回复
热议问题