Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / XAML

Silverlight 1.0 Full JavaScript Intellisense

Rate me:
Please Sign up or sign in to vote.
3.81/5 (16 votes)
21 Dec 2007Ms-PL11 min read 31.9K   141   17  
An article about Silverlight 1.0 full JavaScript Intellisense
<html dir="ltr" xmlns:mshelp="http://msdn.microsoft.com/mshelp"
xmlns:silverlightsdk="http://msdn.microsoft.com/silverlight" xmlns=
"http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="online documentation, web online help, web help, chm2web" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<meta name="generator" content="chm2web Standard 2.7 (unicode)" />
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8" />
<title>Point Structure</title>
<link rel="stylesheet" href="../../default.css" type="text/css" />

<script type="text/JavaScript" src="../../files/supply.js"></script>
<script type="text/JavaScript">
chmtop.c2wtopf.pageid = "reference/o_point.htm";
</script>

</head>
<body topmargin="0"><script type="text/JavaScript"> 
if (window.name != "content") 
  document.write(" <table width=\"100%\" bgcolor=\"#e1e1e1\"cellspacing=\"2\" cellpadding=\"0\" style=\"border-collapse: collapse; font-family: sans-serif; font-size: 14px; color: #000000; text-decoration: none;  \"> <tr> <td align=\"center\" style=\"border-bottom: 2px solid gray\" > <br>&nbsp;Click <a href=\"../../index.html?page=source%2freference%2fo_point.htm\">here</a> to show toolbars of the Web Online Help System: <a href=\"../../index.html?page=source%2freference%2fo_point.htm\">show toolbars</a><br>&nbsp;</td></tr></table><br> "); 
</script>
<!-- !chm2web! -->

<span id="sdkbannersection"></span>
<div class="tableSection"><span id="sdkbannersection"></span>
<table class="buttonbarshade" cellspacing="0">
<tr>
<td>&nbsp;</td>
</tr>
</table>
</div>

<div class="tableSection"><span id="sdkbannersection"></span>
<table class="buttonbartable" cellspacing="0">
<tr id="hdr">
<td class="runninghead" nowrap="nowrap"><img src=
"../common/logo.png" height="21" alt="Silverlight SDK" />
</td>
</tr>
</table>
</div>

<p><span class="betaboilerplate"><font color="gray" pointsize="8.5"
face="Verdana">[This topic is pre-release documentation and is
subject to change in future releases. Blank topics are included as
placeholders.]</font></span>
</p>

<h1><a name="silverlight_point_object"></a>Point Structure</h1>

<div id="mainSection">
<div id="mainBody">
<p>Represents an ordered pair of integer x- and y-coordinates that
defines a point in a two-dimensional plane.</p>

<div id="syntaxblock">
<table class="auto_syntaxtable" id="syntaxtable" style=
"width: 90%; background: #CCCCCC; border: none;">
<tr id="xamlSyntaxBlock">
<th class="syntaxblocklanguage" nowrap="nowrap" style=
"width: 150px; background: #EEEEEE; vertical-align: top;">XAML</th>
<td class="syntaxblockcode" style="background:white;">
<div class="codesyntax">
&lt;<i>object</i>.<i>property</i>&nbsp;=&nbsp;"<i>X</i>,<i>Y</i>"
/&gt;</div>
-or-<br />

<div class="codesyntax">
&lt;<i>object</i>.<i>property</i>&nbsp;=&nbsp;"<i>X</i>&nbsp;<i>Y</i>"
/&gt;</div></td>
</tr>

<tr id="scriptingSyntaxBlock">
<th class="syntaxblocklanguage" nowrap="nowrap" style=
"width: 150px; background: #EEEEEE; vertical-align: top;">
Scripting</th>
<td class="syntaxblockcode" style="background:white;">
<div class="codesyntax">See Remarks.</div>
</td>
</tr>
</table>
</div>

<h4>Properties</h4>

<p>The X and Y properties are not available in the object model,
because <b>Point</b> itself is not returned as an object.</p>
<span id="remarkssection"></span>
<p><span id="remarkssection">The <b>Point</b> structure is a
convention that is supported by a type converter, such that
properties that take a <b>Point</b> as their value can specify a
<b>Point</b> as a formatted string. It is not a true object. The
type converter generates a new <b>Point</b> value based on
processing the string. The type converter functions both for XAML
usages and script usages. In both cases, you supply a quoted
string. The format of that string is an X,Y value pair.
Alternatively, you can use a space rather than a comma as the
delimiter betweeen X and Y in the string.</span>
</p>

<p>In scripting, it is generally true that you cannot construct a
new Silverlight object based on a constructor. However, for casese
of types that have type converter support, you can use the type
converter behavior to generate the object from out of a convertible
type, in this case a string. So, in order to generate a
<b>Point</b> value in script, you must target a property that takes
a <b>Point</b> (such as <a href=
"p_linegeometry_endpoint.htm">EndPoint</a> in this example) and
write code such as the following:</p>

<div class="snippetdistributor_codesnippet" id=
"geometries_overview_snip#LinearGeometryOMPoint">
<div style="width: 99%;">
<table class="codeexampletable" style=
"border: 1px solid #999999; background: #CCCCCC; width: 99%;">
<tr>
<th class="codelanguagecell" style=
"background: #CCCCCC; text-align: left;">JavaScript</th>
</tr>

<tr>
<td class="codeblockcell" style=
"background: #e6e6e6; border: none;">
<pre class="codeblock" style=
"background: transparent; border: none; margin: 0px; padding: 0px; font-family:'Courier New', Courier, monospace;">

function moveLine(sender, args) {
   myPath = sender.findName("myPath");
   myPath.Data.EndPoint = "250,150";
}
</pre>
</td>
</tr>
</table>
</div>
</div>

<p>In this example, <i>myPath</i> is a <a href=
"o_path.htm">Path</a> previously defined in XAML, and the function
is attached to a <a href="o_canvas.htm">Canvas</a> root as a mouse
event handler.</p>

<p>X and Y can be non-integer values in terms of permitted values,
but are interpreted as integers regardless during rendering. In
general, you should not use noninteger values. In particular, the
comma used as X,Y separator in the type converter behavior will
clash with cultural usages where the comma is the decimal division
symbol if that value is entered as a string.</p>

<p><b>Point</b> is the value type that is returned from a call to
the <a href="m_mouseeventargs_getposition.htm">GetPosition</a>
method used in mouse event handlers. <b>Point</b> is also used
extensively as a property value in geometry-related objects and for
<a href="o_inkpresenter.htm">InkPresenter</a>.</p>

<p>If you attempt to get values through scripting where the value
is a <b>Point</b>, the <a href=
"m_dependencyobject_getvalue.htm">GetValue</a> call will fail. This
is because the object model does not use <b>Point</b> as a true
object, and the type conversion behavior does not provide a reverse
conversion to provide a "ToString" or other value representation to
the object model.</p>
<span id="seealsosection"></span>
<h4><span id="seealsosection">See Also</span>
</h4>

<p><a href=
"../conceptual/c_silverlight_path_markup_syntax_overview.htm">Path
Markup Syntax</a>, <a href=
"../conceptual/c_silverlight_transforms.htm">Silverlight Transforms
Overview</a></p>
</div>
</div>

<script type="text/JavaScript">
var fe = FindFrame("toc", top);
if ((fe != null) && (chmtop.c2wtopf.jstree != null)) {
  if (chmtop.c2wtopf.FITEMS[chmtop.c2wtopf.pagenum] != chmtop.c2wtopf.pageid)
    chmtop.c2wtopf.jstree.OpenTreeNode("source/" + chmtop.c2wtopf.pageid);
}
</script>

<!-- CHM2WEB -->
<!-- DO NOT DELETE OR MODIFY THIS CODE WITHOUT 
     WRITTEN PERMISSION OF A!K RESEARCH LABS -->
<table width="100%" cellspacing="0" cellpadding="0" 
style="margin-top: 0pt; border-collapse: collapse;"> 
<tr> <td align="right" style="background-color:white; border-top: 1px solid gray;"> 
<a href="http://chm2web.aklabs.com" target="_blank" style="font-family: sans-serif;  font-size: 11px; text-decoration: none;"><font color="gray">Converted from CHM to HTML with <b>chm2web Standard 2.7 (unicode)</b></font></a>
</td></tr></table> 
<!-- /CHM2WEB -->

</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
JustinAngel.Net, Senior .Net consultant
Israel Israel
Justin-Josef Angel is a C# Microsoft Most Valuable professional, a Senior .Net consultant in Israel with 4 years of .Net experience and has 8 years of Web experience.

Justin's been working this past year on two Enterprise sized Silverlight projects with his customers. During that time he's gained a real-insight into Silverlight's inner workings and how to integrate Silverlight into the real world of software development. Additionally, During that time he's developed a few well-known projects like the "Silverlight 1.0 Javascript Intellisense", "Silverlight 1.1 Hebrew & Arabic Languages support" and a few others you might know.

Justin is also a seasoned presenter with an impressive track-record of talking in front of thousands of people in Israel.

Justin owns the first .Net blog written in Hebrew - http://www.JustinAngel.Net .
And he also owns an additional blog with mixed Hebrew & English content - http://blogs.Microsoft.co.il/blogs/JustinAngel.

A full list of his articles (all 100+ of them) can be found at: http://www.JustinAngel.Net/#index




Comments and Discussions