Windows Phone 7 dialog box message prompt

Source: Internet
Author: User

In the previous blog 《The latest development tool library for Windows Phone 7"Introduces the phoney Project, which contains a message prompt for fade-in and fade-out. This article will expand this message prompt to display a glass border for the prompt message, similar to Windows 7 forms.

First, let's take a look at the running effect:

In fact, simply adding a glass style to the pop-up box.

The specific modification method is as follows:

DozenOpen fadingmessage. CS under phoneytoolsFile, findStandardmessageMethod, add the followingCodeYou can.

 # Region Border
Lineargradientbrush Brush = New Lineargradientbrush ();
Brush. endpoint =New Point (0.5, 1 );
Brush. startpoint = New Point (0.5, 0 );
Gradientstop GS1 = New Gradientstop ();
Gs1.color = Color . Fromargb (58, 11, 32, 45 );
Gs1.offset = 0;

Gradientstop Gs2 = New Gradientstop ();
Gs2.color = Color . Fromargb (62,255,255,255 );
Gs2.offset = 0.25;

Gradientstop GS3 = New Gradientstop ();
Gs3.color = Color . Fromargb (255,255,255,255 );
Gs3.offset = 0.5;

Gradientstop Gs4 = New Gradientstop ();
Gs4.color = Color . Fromargb (62,255,255,255 );
Gs4.offset = 0.75;

Gradientstop Gs5 = New Gradientstop ();
Gs5.color = Color . Fromargb (191,255,255,255 );
Gs5.offset = 1;

Gradientstopcollection GSC = New Gradientstopcollection ();
GSC. Add (GS1 );
GSC. Add (gs2 );
GSC. Add (GS3 );
GSC. Add (gs4 );
GSC. Add (gs5 );

Brush. gradientstops = GSC;
# Endregion

# Region Background
Lineargradientbrush Brushforbg = New Lineargradientbrush ();
Brushforbg. endpoint = New Point (0.5, 1 );
Brushforbg. startpoint =New Point (0.5, 0 );
Gradientstop Gsbg1 = New Gradientstop ();
Gsbg1.color = Color . Fromargb (33,255,255,255 );
Gsbg1.offset = 0;

Gradientstop Gsbg2 = New Gradientstop ();
Gsbg2.color = Color . Fromargb (192,255,255,255 );
Gsbg2.offset = 0.287;

Gradientstop Gsbg3 = New Gradientstop ();
Gsbg3.color = Color . Fromargb (255,255,255,255 );
Gsbg3.offset = 0.683;

Gradientstop Gsbg4 = New Gradientstop ();
Gsbg4.color = Color . Fromargb (33,255,255,255 );
Gsbg4.offset = 1;

Gradientstopcollection Gsc2 = New Gradientstopcollection ();
Gsc2.add (gsbg1 );
Gsc2.add (gsbg2 );
Gsc2.add (gsbg3 );
Gsc2.add (gsbg4 );

Brushforbg. gradientstops = gsc2;
# Endregion




VaR Thecontainer = New Border ()
{
// Background = phonebrushes. phonecontrastbackgroundbrush,
// Borderbrush = phonebrushes. phoneborderbrush,
Background = brushforbg, // Change to transparent background
Borderbrush = brush, // Modify it to a glass border
Borderthickness = Phonethicknesses . Phoneborderthickness,
Cornerradius = New Cornerradius (5)
};

Replace the original paint brush with the one written in C # code.

In addition, we share a very good Silverlight glass effect button style.

 <  Style X  :  Key  = "Glassborderstyle"  Targettype  = "Border">
< Setter Property = "Borderthickness" Value = "2"/>
< Setter Property = "Padding" Value = "5"/>
< Setter Property = "Background">
< Setter. Value >
< Lineargradientbrush Endpoint = "0.75, 1" Startpoint = "0.25, 0">
< Gradientstop Color = "#33 ffffff" Offset = "0"/>
< Gradientstop Color = "# C0ffffff" Offset = "0.287"/>
< Gradientstop Color = "# 4011322d" Offset = "0.683"/>
< Gradientstop Color = "#33 ffffff" Offset = "1"/>
</ Lineargradientbrush >
</ Setter. Value >
</ Setter >
< Setter Property = "Borderbrush">
< Setter. Value >
< Lineargradientbrush Endpoint = "0.5, 1" Startpoint = "0.5, 0">
< Gradientstop Color = "# 5811322d" Offset = "0"/>
< Gradientstop Color = "#3 effffff" Offset = "0.25"/>
< Gradientstop Color = "# Ffffffff" Offset = "0.5"/>
< Gradientstop Color = "#3 effffff" Offset = "0.75"/>
< Gradientstop Color = "# Bfffffff" Offset = "1"/>
</ Lineargradientbrush >
</ Setter. Value >
</ Setter >
< Setter Property = "Effect">
< Setter. Value >
< Dropshadoweffect Blurradius = "3" Shadowdepth = "3" Opacity = "0.5"/>
</ Setter. Value >
</ Setter >
</ Style >

Usage:

    border   x  :   name  =" glassborder "  height  =" 100 "  width  =" 250 "  cornerradius  =" 10 "  style  =" {  staticresource   glassborderstyle  }"> 
button content =" Glass Border style "/>
border >< br>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.