<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Everything Silverlight &#187; keyboard</title>
	<atom:link href="http://www.michaelsnow.com/tag/keyboard/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michaelsnow.com</link>
	<description></description>
	<lastBuildDate>Thu, 28 Apr 2011 21:43:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Silverlight Tip of the Day #8 &#8211; Detecting Alt, Shift, Control, Window &amp; Apple Keys Combinations</title>
		<link>http://www.michaelsnow.com/2010/04/29/silverlight-tip-of-the-day-8-detecting-alt-shift-control-window-apple-keys-combinations/</link>
		<comments>http://www.michaelsnow.com/2010/04/29/silverlight-tip-of-the-day-8-detecting-alt-shift-control-window-apple-keys-combinations/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 17:01:34 +0000</pubDate>
		<dc:creator>Snowman</dc:creator>
				<category><![CDATA[keyboard]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.silverlightdev.net/?p=116</guid>
		<description><![CDATA[When mouse clicking or typing a key in your Silverlight application how do you know if any combination of the &#60;Alt&#62;, &#60;Shift&#62;, &#60;Ctrl&#62;, &#60;Windows&#62; and/or &#60;Apple&#62; keys are down as well? To accomplish this you simply need to check the Keyboard.Modifiers member which returns a ModifierKeys object. The following code demonstrates how to get this [...]]]></description>
			<content:encoded><![CDATA[<p>When mouse clicking or typing a key in your Silverlight application how do you know if any combination of the &lt;Alt&gt;, &lt;Shift&gt;, &lt;Ctrl&gt;, &lt;Windows&gt; and/or &lt;Apple&gt; keys are down as well? </p>
<p>To accomplish this you simply need to check the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.keyboard.modifiers.aspx">Keyboard.Modifiers</a> member which returns a <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.modifierkeys.aspx">ModifierKeys</a> object.</p>
<p>The following code demonstrates how to get this object and how to check if any of these keys have been pressed:</p>
<div class="csharpcode">
<pre class="alt">ModifierKeys keys = Keyboard.Modifiers; </pre>
<pre>&#160;</pre>
<pre class="alt"><span class="kwrd">bool</span> shiftKey = (keys &amp; ModifierKeys.Shift) != 0; </pre>
<pre><span class="kwrd">bool</span> altKey = (keys &amp; ModifierKeys.Alt) != 0; </pre>
<pre class="alt"><span class="kwrd">bool</span> appleKey = (keys &amp; ModifierKeys.Apple) != 0; </pre>
<pre><span class="kwrd">bool</span> controlKey = (keys &amp; ModifierKeys.Control) != 0; </pre>
<pre class="alt"><span class="kwrd">bool</span> windowsKey = (keys &amp; ModifierKeys.Windows) != 0;</pre>
</div>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p><p><font color="#80ff80"></font></p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:ea7b2b6f-3ab1-4864-a11e-03570730c3f2" class="wlWriterEditableSmartContent">
<p>Source: <a href="http://www.michaelsnow.com/wp-content/uploads/2010/06/Tip8_ModiferKeys.zip" target="_blank">Tip8_ModifierKeys</a></p>
</div>
</p>
<p>Demo:</p>
<p>[silverlight: Tip8_ModiferKeys.xap]</p>
<p>Thank you,<br />
  <br />&#8211;Mike</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelsnow.com/2010/04/29/silverlight-tip-of-the-day-8-detecting-alt-shift-control-window-apple-keys-combinations/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

