Slow and steady Silverlight (1)

Source: Internet
Author: User

Cases

Clock.xaml (developed with Expression Blend)

<canvas
Xmlns= "http://schemas.microsoft.com/client/2007"
xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"
Width= "180" height= "150"
Background= "#0030628D"
X:name= "Page" loaded= "Enableclock"
>
<rectangle x:name= "Frame" width= "180" height= "stroke=" "#FF000000" strokethickness= "1" radiusx= "radiusy=" 15 ">
<Rectangle.Fill>
<lineargradientbrush endpoint= "0.5,1.1" startpoint= "0.5,-0.1" >
<gradientstop color= "#FF259888" offset= "0"/>
<gradientstop color= "#FF259888" offset= "0.981"/>
<gradientstop color= "#FFC87947" offset= "0.416"/>
<gradientstop color= "#FFC87947" offset= "0.636"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<rectangle x:name= "Panel" width= "164" height= "134" fill= "#7F91B52C" stroke= "#FFA2AEBF" radiusx= "radiusy=" "15" canvas.left= "8" canvas.top= "8" strokethickness= "2"/>

<path x:name= "Line1" width= "163" height= "1" fill= "#FF100888" stretch= "Fill" stroke= "#FF1B510C" canvas.left= "8" canvas.top= "Data=" "m33.50029,83.29705 l161.89657,83.297051"/>
<path x:name= "Line2" width= "1" height= "fill=" "#FF100888" stretch= "Fill" stroke= "#FF1B510C" canvas.left= "63" canvas.top= "Data=" "m81.450752,138.29705 l81.450752,90.29705"/>
<path x:name= "Line3" width= "1" height= "fill=" "#FF100888" stretch= "Fill" stroke= "#FF1B510C" canvas.left= "119" canvas.top= "Data=" "m118.30501,164.29698 l118.30501,116.29699"/>

<textblock x:name= "Month" width= "height=" canvas.left= "32.5" canvas.top= "he" textwrapping= "Wrap" foreground = "#FF100888" text= "M"/>
<textblock width= "height=" canvas.left= "canvas.top=", "textwrapping=" Wrap "X:name=" Day "foreground=" # FF100888 "text=" D "/>
<textblock width= "height=" "canvas.left=" 136 "canvas.top=" "textwrapping=" Wrap "x:name=" Week "foreground=" #FF100888 "text=" W "/>

<textblock x:name= "Txtmonth" width= "height=", "canvas.left=", "canvas.top=" and "textwrapping=" Foreground= "#FF100888" text= "/>"
<textblock x:name= "Txtday" width= "20.5" height= "canvas.left=" and "83.5" canvas.top= "textwrapping=" "Wrap" Foreground= "#FF100888" text= "/>"
<textblock x:name= "Txtweek" width= "32.5" height= "canvas.left=" and "130" canvas.top= "textwrapping=" "Wrap" Foreground= "#FF100888" text= "Sun"/>

<textblock x:name= "Txthour" width= "" height= "" "canvas.left=" 14.5 "canvas.top=" "" textwrapping= "Wrap" FontSize " = "foreground=" text= "/>"
<textblock x:name= "Txtminute" width= "a" height= "canvas.left=" 68.5 canvas.top= "the" "Textwrapping=" Wrap " Fontsize= "foreground=" "" #FF100888 "text="/>
<textblock x:name= "Txtsecond" width= "The Height=" "canvas.left=" "122" canvas.top= "textwrapping=" Wrap " Fontsize= "foreground=" "" #FF100888 "text="/>

<textblock x:name= "Colon1" width= "9.5" "height=" canvas.left= "62.5" "canvas.top=" textwrapping= "Wrap" foreground= "#FF100888" "text=": "Fontsize="/>
<textblock x:name= "Colon2" width= "height=" canvas.left= "116.5" "canvas.top=" textwrapping= "Wrap" foreground= "#FF100888" "text=": "Fontsize="/>

<textblock x:name= "Copyright" width= "height=" canvas.left= "" textwrapping= "Wrap" fontsize= "" Canvas.Top = "foreground=" "#FF100888" text= "WEBABCD Clock" mouseleftbuttondown= "MouseLeftButtonDown" mousemove= "MouseMove" Mouseleave= "MouseLeave"/>
<textblock x:name= "fullscreen" width= "height=" canvas.left= "June" textwrapping= "Wrap" fontsize= "12" canvas.top= "foreground=" "#FF100888" "text=" fullscreen "mouseleftbuttondown=" Toggle_fullscreen "mousemove=" MouseMove "mouseleave=" MouseLeave "/>
</Canvas>

Clock.xaml.js

if (!window. Clock)
Window. Clock = {};

Clock.page = function ()
{
}

Clock.Page.prototype =
{
Handleload:function (Control, UserContext, rootelement)
{
This.control = control;

Sample Event Hookup:
Rootelement.addeventlistener ("MouseLeftButtonDown", Silverlight.createdelegate (this, this.handlemousedown));
},

Sample event Handler
Handlemousedown:function (sender, EventArgs)
{
The following line of code shows you to find an element by name and call a method on it.
This.control.content.findName ("Timeline1"). Begin ();
}
}

The method of TextBlock MouseLeftButtonDown call
function MouseLeftButtonDown (sender, args)
{
window.open ("http://webabcd.cnblogs.com");
}

The method of TextBlock MouseMove call
function MouseMove (sender, args)
{
Textblock.foreground
Sender.foreground = "Red";
Textblock.textdecorations
Sender.textdecorations = "Underline";
}

The method of TextBlock MouseLeave call
function MouseLeave (sender, args)
{
Textblock.foreground
Sender.foreground = "#FF100888";
Textblock.textdecorations
Sender.textdecorations = "None";
}

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.