<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Silverlight Blog</title>
	
	<link>http://silverlightblog.saschabaumann.com</link>
	<description>The Blog about Microsoft Silverlight, Windows Presentation Foundation and Windows Phone 7 - Blog.SilverlightDeveloper.de</description>
	<lastBuildDate>Tue, 15 Jun 2010 15:31:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/saschabaumann/silverlightBlog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="saschabaumann/silverlightblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Easy usage of INotifyPropertyChanged with Property-Attribute</title>
		<link>http://silverlightblog.saschabaumann.com/2010/06/easy-usage-of-inotifypropertychanged-with-property-attribute/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/06/easy-usage-of-inotifypropertychanged-with-property-attribute/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 13:19:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[Various]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/?p=152</guid>
		<description><![CDATA[Hello everyone,
today I want to share an implementation I&#8217;m using in my personal prototyping-Framework for Silverlight. This is important to mention, because I have tested it only for &#8220;works&#8221; but not including any productive parameters like memory-usage or processing-time. 
The meaning of a prototyping-framework for me is to get thinks working as quick as possible, [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>today I want to share an implementation I&#8217;m using in my personal prototyping-Framework for Silverlight. This is important to mention, because I have tested it only for &#8220;works&#8221; but not including any productive parameters like memory-usage or processing-time. </p>
<p>The meaning of a prototyping-framework for me is to get thinks working as quick as possible, to show the outcome to my customer. There are some things I need very often, and so I&#8217;m using base-classes a lot. </p>
<p><span id="more-152"></span></p>
<p>One of them is <i>ModelBase</i>. Every time I need a Model kind of class, I let it inherit from <i>ModelBase</i> and even my <i>ViewModelBase</i> is inheriting from it. </p>
<p>This base-class is implementing <i>INotifyPropertyChanged</i> and offers me ways to deal with this kind of properties. A typical implementation of a property within a model would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"> 	<span style="color: #000000;">&#91;</span>IsNotifyingProperty<span style="color: #000000;">&#40;</span>NotifyAlsoFor <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;FullName&quot;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> FirstName
        <span style="color: #000000;">&#123;</span>
            get
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">return</span> GetProperty<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            set
            <span style="color: #000000;">&#123;</span>
                SetProperty<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>, value<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>

<p>You recognize two things. First the Attribute called <i>IsNotifyingProperty</i> and the other one are the two access-methods just taking the current object and in case of <i>SetProperty</i> the value to set. You see, its very easy to copy-and-paste if needed, and no further changes are necessary when the name changes (Except the binding somewhere).</p>
<p>The Implementation of the attribute looks like this: </p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">namespace</span> BaumannSolutions.<span style="color: #0000FF;">Common</span>.<span style="color: #0000FF;">Attributes</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> IsNotifyingProperty <span style="color: #008000;">:</span> Attribute
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> NotifyAlsoFor <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>You see, there is one property in it, we will get to this later. A property itself isn&#8217;t enough to do what is planned, so there is some code in the constructor of <i>ModelBase</i> that looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">var props <span style="color: #008000;">=</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">GetProperties</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>PropertyInfo pi <span style="color: #0600FF;">in</span> props<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                var attr <span style="color: #008000;">=</span> pi.<span style="color: #0000FF;">GetCustomAttributes</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> o <span style="color: #0600FF;">in</span> attr<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>o <span style="color: #008000;">is</span> IsNotifyingProperty <span style="color: #008000;">&amp;&amp;</span> <span style="color: #008000;">!</span>NotificationProperties.<span style="color: #0000FF;">ContainsKey</span><span style="color: #000000;">&#40;</span>pi.<span style="color: #0000FF;">Name</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                    <span style="color: #000000;">&#123;</span>
                        Type proptype <span style="color: #008000;">=</span> pi.<span style="color: #0000FF;">PropertyType</span>.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                        NotificationProperties.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>pi.<span style="color: #0000FF;">Name</span>, ModelBase.<span style="color: #0000FF;">GetDefault</span><span style="color: #000000;">&#40;</span>proptype<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>IsNotificationChanged<span style="color: #000000;">&#41;</span>o<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">NotifyAlsoFor</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            NotificationAlsoProperties.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>pi.<span style="color: #0000FF;">Name</span>, <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>IsNotificationChanged<span style="color: #000000;">&#41;</span> o<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">NotifyAlsoFor</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                        <span style="color: #000000;">&#125;</span>
                    <span style="color: #000000;">&#125;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span></pre></div></div>

<p>and these class wide collections:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">protected</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span>, <span style="color: #FF0000;">object</span><span style="color: #008000;">&gt;</span> NotificationProperties <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span>, <span style="color: #FF0000;">object</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">protected</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span>,<span style="color: #FF0000;">object</span><span style="color: #008000;">&gt;</span> NotificationAlsoProperties <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span>,<span style="color: #FF0000;">object</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>As you see in the code, reflection is used to check for the properties and there attributes, and if <i>IsNotificationProperty</i> is found, the Property will be added to the collection <i>NotificationProperties</i> and there will be stored a default-value via a helper method. I wont publish it here, it should be very obvious what the method is doing.</p>
<p>You have also the chance to give a property, for which there should also be a <i>PropertyChanged</i> event in case the current Property is changed. I hope I&#8217;ve chosen a good example by using <i>FirstName</i> and <i>FullName</i>. If the <i>FirstName</i> is changed, you may want to raise <i>PropertyChanged</i> also for the <i>FullName</i>, cause <i>FirstName</i> is a subset of it.</p>
<p>the last parts we need are the two methods <i>GetProperty</i> and <i>SetProperty</i>. They look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">&nbsp;
  <span style="color: #0600FF;">protected</span> V GetProperty<span style="color: #008000;">&lt;</span>V<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span>DependencyObject parent<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
             var name <span style="color: #008000;">=</span> GetPreviousMethodName<span style="color: #000000;">&#40;</span>MethodBase.<span style="color: #0000FF;">GetCurrentMethod</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;get_&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
             <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>NotificationProperties.<span style="color: #0000FF;">ContainsKey</span><span style="color: #000000;">&#40;</span>name<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
             <span style="color: #000000;">&#123;</span>
                 <span style="color: #0600FF;">try</span>
                 <span style="color: #000000;">&#123;</span>
                     var ret <span style="color: #008000;">=</span> NotificationProperties<span style="color: #000000;">&#91;</span>name<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
                     <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ret <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
                         <span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span>V<span style="color: #000000;">&#41;</span> ret<span style="color: #008000;">;</span>
&nbsp;
                     <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">default</span><span style="color: #000000;">&#40;</span>V<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                 <span style="color: #000000;">&#125;</span>
                 <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception<span style="color: #000000;">&#41;</span>
                 <span style="color: #000000;">&#123;</span>
                     <span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span>V<span style="color: #000000;">&#41;</span>GetDefault<span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>V<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                 <span style="color: #000000;">&#125;</span>
&nbsp;
             <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">default</span><span style="color: #000000;">&#40;</span>V<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
 <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">void</span> SetProperty<span style="color: #000000;">&#40;</span>DependencyObject parent, <span style="color: #FF0000;">object</span> value<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            var name <span style="color: #008000;">=</span> GetPreviousMethodName<span style="color: #000000;">&#40;</span>MethodBase.<span style="color: #0000FF;">GetCurrentMethod</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;set_&quot;</span>, <span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>NotificationProperties.<span style="color: #0000FF;">ContainsKey</span><span style="color: #000000;">&#40;</span>name<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                NotificationProperties<span style="color: #000000;">&#91;</span>name<span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
                RaisePropertyChanged<span style="color: #000000;">&#40;</span>name<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>NotificationAlsoProperties.<span style="color: #0000FF;">ContainsKey</span><span style="color: #000000;">&#40;</span>name<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                    RaisePropertyChanged<span style="color: #000000;">&#40;</span>NotificationAlsoProperties<span style="color: #000000;">&#91;</span>name<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
  <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> GetPreviousMethodName<span style="color: #000000;">&#40;</span>MethodBase currentMethod<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">string</span> methodName <span style="color: #008000;">=</span> <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF;">try</span>
            <span style="color: #000000;">&#123;</span>
                StackTrace sTrace <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StackTrace<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span>Int32 frameCount <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> frameCount <span style="color: #008000;">&lt;</span> sTrace.<span style="color: #0000FF;">FrameCount</span><span style="color: #008000;">;</span> frameCount<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    StackFrame sFrame <span style="color: #008000;">=</span> sTrace.<span style="color: #0000FF;">GetFrame</span><span style="color: #000000;">&#40;</span>frameCount<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                    MethodBase thisMethod <span style="color: #008000;">=</span> sFrame.<span style="color: #0000FF;">GetMethod</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>thisMethod <span style="color: #008000;">==</span> currentMethod<span style="color: #000000;">&#41;</span>
                    <span style="color: #000000;">&#123;</span>
                        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>frameCount <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&lt;=</span> sTrace.<span style="color: #0000FF;">FrameCount</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #000000;">&#123;</span>
                            StackFrame prevFrame <span style="color: #008000;">=</span> sTrace.<span style="color: #0000FF;">GetFrame</span><span style="color: #000000;">&#40;</span>frameCount <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                            MethodBase prevMethod <span style="color: #008000;">=</span> prevFrame.<span style="color: #0000FF;">GetMethod</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                            methodName <span style="color: #008000;">=</span> prevMethod.<span style="color: #0000FF;">Name</span><span style="color: #008000;">;</span>
                        <span style="color: #000000;">&#125;</span>
                        break<span style="color: #008000;">;</span>
                    <span style="color: #000000;">&#125;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception ex<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF;">return</span> methodName<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>

<p>So, you read carefully and have recognized a third method I haven&#8217;t mentioned yet <img src='http://silverlightblog.saschabaumann.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Its just a helper-method to get the name if the calling Method. In our cases it will be <i>set_Firstname</i> and <i>get_Firstname</i>, the getter and setter of the property. That&#8217;s why you just have to pass <i>this</i> and don&#8217;t need to give the property name as a parameter. Just to make it even more simple to use and copy-and-paste the code.</p>
<p>The <i>GetProperty</i> generic method returns the typed property-value from the inner-collection and the <i>SetProperty</i> sets the value within this collection. It also raises <i>PropertyChanged</i> for the value and if defined the <i>PropertyChanged</i> for a related value. </p>
<p>Hope that gives you some inspiration to implement your own little framework to make live easier. I have a similar implementation for DependencyProperties and I will write about that soon.</p>
<p>Cya</p>
<p>Sascha</p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/06/easy-usage-of-inotifypropertychanged-with-property-attribute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight Localization</title>
		<link>http://silverlightblog.saschabaumann.com/2010/05/silverlight-applications-localization/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/05/silverlight-applications-localization/#comments</comments>
		<pubDate>Mon, 24 May 2010 14:35:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Various]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/?p=142</guid>
		<description><![CDATA[Hello everyone,
I originally planed to write a blog-post about the right way to localize Silverlight Apps. While researching I came across two really good posts about that topic already. So instead of writing the same stuff again, I follow an extended D.R.Y.-Principal ( I might call it D.R.O.P &#8211; Don&#8217;t repeat other people   [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>I originally planed to write a blog-post about the right way to localize Silverlight Apps. While researching I came across two really good posts about that topic already. So instead of writing the same stuff again, I follow an extended D.R.Y.-Principal ( I might call it D.R.O.P &#8211; Don&#8217;t repeat other people <img src='http://silverlightblog.saschabaumann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) and point you in the right direction instead <img src='http://silverlightblog.saschabaumann.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' />  </p>
<p>A short but clear post about Localization was written by <a href="http://dotnet-redzone.blogspot.com/2010/04/localization-in-silverlight-3.html" target="_blank">Patric Schouler on dotnet-redzone.blogspot.com</a>.</p>
<p>If you like more detail and &quot;Hands-On&quot;-Experience have a look at <a href="http://blogs.msdn.com/brada/archive/2010/03/22/silverlight-4-ria-services-ready-for-business-localizing-business-application.aspx"  target="_blank">the Post &quot;Localizing Business Application&quot; by Brad Adams</a>.</p>
<p>Keep on improving !</p>
<p>Sascha</p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/05/silverlight-applications-localization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nice Phone 7 Game</title>
		<link>http://silverlightblog.saschabaumann.com/2010/05/nice-phone-7-game/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/05/nice-phone-7-game/#comments</comments>
		<pubDate>Sat, 15 May 2010 09:52:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows Phone 7 (WP7)]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/?p=137</guid>
		<description><![CDATA[Hi everyone,
just found a nice Silverlight game for Phone 7. You can play it in the browser, don&#8217;t need a phone or emulator.
Check out DroppyPop
Cheers
Sascha
]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>just found a nice Silverlight game for Phone 7. You can play it in the browser, don&#8217;t need a phone or emulator.<br />
<a href="http://www.spritehand.com/silverlight/3.0/droppypop/droppypop.htm" target="_blank">Check out DroppyPop</a></p>
<p>Cheers<br />
Sascha</p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/05/nice-phone-7-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generic View Models in Silverlight</title>
		<link>http://silverlightblog.saschabaumann.com/2010/05/generic-view-models-in-silverlight/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/05/generic-view-models-in-silverlight/#comments</comments>
		<pubDate>Fri, 14 May 2010 09:44:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[Various]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[ViewModel]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/?p=123</guid>
		<description><![CDATA[I like using Base-Classes for any kind of &#8220;Class-Group&#8221;. Very prominent groups are Models and ViewModels in Silverlight-Applications.
  The ViewModel-Baseclass can hold any functionality, that applies to every ViewModel inheriting from it and, if we are talking about Generics, can be very convenient to use. 
For example, if I want to apply the factory-pattern [...]]]></description>
			<content:encoded><![CDATA[<p>I like using Base-Classes for any kind of &#8220;Class-Group&#8221;. Very prominent groups are Models and ViewModels in Silverlight-Applications.<br />
  <br />The ViewModel-Baseclass can hold any functionality, that applies to every ViewModel inheriting from it and, if we are talking about Generics, can be very convenient to use. </p>
<p>For example, if I want to apply the factory-pattern to my ViewModels and want every Model to have a static Create-Method I can simply implement this Method in the Base-Class.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> ViewModelBase 
<span style="color: #000000;">&#123;</span> 
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> ViewModelBase Create<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> 
	<span style="color: #000000;">&#123;</span> 
		<span style="color: #0600FF;">return</span> <span style="color: #008000;">new</span> ViewModelBase<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
	<span style="color: #000000;">&#125;</span> 
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Of cause, without Generics we are limited to the return-Type. We could now override this method in every specific ViewModel to at least return the right ancestor of ViewModelBase. An easier way is, to use Generics for this case. The class could look like this :</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> ViewModelBase<span style="color: #008000;">&lt;</span>TViewModel<span style="color: #008000;">&gt;</span> where TViewModel <span style="color: #008000;">:</span> ViewModelBase 
<span style="color: #000000;">&#123;</span> 
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> TViewModel Create<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> 
	<span style="color: #000000;">&#123;</span> 
		<span style="color: #0600FF;">return</span> Activator.<span style="color: #0000FF;">CreateInstance</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>TViewModel<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
	<span style="color: #000000;">&#125;</span> 
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now we can simply create our new specific ViewModel like this</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> MyViewModel <span style="color: #008000;">:</span> ViewModelBase<span style="color: #008000;">&lt;</span>MyViewModel<span style="color: #008000;">&gt;</span></pre></div></div>

<p>to get what we want generically.</p>
<p>&#160;</p>
<p>Another possible scenario would be the following. We know, every ViewModel contains a Collection of Models, all inheriting from a class called ModelBase. we could extend out code the following way:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> ViewModelBase<span style="color: #008000;">&lt;</span>TViewModel<span style="color: #008000;">&gt;</span> where TViewModel <span style="color: #008000;">:</span> ViewModelBase 
<span style="color: #000000;">&#123;</span> 
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> TViewModel Create<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> 
	<span style="color: #000000;">&#123;</span> 
		<span style="color: #0600FF;">return</span> Activator.<span style="color: #0000FF;">CreateInstance</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>TViewModel<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
	<span style="color: #000000;">&#125;</span> 
&nbsp;
	<span style="color: #0600FF;">public</span> List<span style="color: #008000;">&lt;</span>ModelBase<span style="color: #008000;">&gt;</span> MyList <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span> 
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>or, the better way, we could extend our Generic header to be type safe.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> ViewModelBase<span style="color: #008000;">&lt;</span>TViewModel, TChildModel<span style="color: #008000;">&gt;</span> 	
                                        where TViewModel <span style="color: #008000;">:</span> ViewModelBase 
					where TChildModel <span style="color: #008000;">:</span> ModelBase 
<span style="color: #000000;">&#123;</span> 
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> TViewModel Create<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> 
	<span style="color: #000000;">&#123;</span> 
		<span style="color: #0600FF;">return</span> Activator.<span style="color: #0000FF;">CreateInstance</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>TViewModel<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
	<span style="color: #000000;">&#125;</span> 
&nbsp;
	<span style="color: #0600FF;">public</span> List<span style="color: #008000;">&lt;</span>TChildModel<span style="color: #008000;">&gt;</span> MyList <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span> 
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Defining a Class by </p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> MyViewModel <span style="color: #008000;">:</span> ViewModelBase<span style="color: #008000;">&lt;</span>MyViewModel, MyModel<span style="color: #008000;">&gt;</span></pre></div></div>

<p>Like always, if we talk about inheritance, you should avoid to go too far with that. I implemented a Framework I use for rapid prototyping where a lot of things are done in the base-class via reflection, but in a productive environment its not always what you want. Plan your development as precise as possible.</p>
<ul>
<li>What do you want to be individually implemented by each ViewModel ? </li>
<li>When is it a good thing to implement it in the Base-Class ? </li>
<li>How confusing is you inheritance for other developers ? </li>
</ul>
<p>&#160;</p>
<p>Good Luck <img src='http://silverlightblog.saschabaumann.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/05/generic-view-models-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally: Silverlight 3 and Silverlight 4 Beta Runtime on same computer</title>
		<link>http://silverlightblog.saschabaumann.com/2010/02/finally-silverlight-3-and-silverlight-4-beta-runtime-on-same-computer/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/02/finally-silverlight-3-and-silverlight-4-beta-runtime-on-same-computer/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 21:59:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[Various]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/2010/02/finally-silverlight-3-and-silverlight-4-beta-runtime-on-same-computer/</guid>
		<description><![CDATA[I read very often things like &#8220;Should work, cause its downward compatible&#8221;. But I&#8217;m too long in the business to trust sentences like this &#8211; so basically If I write a Silverlight 3 App for a customer I want to test it with the SL 3 Runtime, if I play around with the new SL [...]]]></description>
			<content:encoded><![CDATA[<p>I read very often things like &#8220;Should work, cause its downward compatible&#8221;. But I&#8217;m too long in the business to trust sentences like this &#8211; so basically If I write a Silverlight 3 App for a customer I want to test it with the SL 3 Runtime, if I play around with the new SL 4 Features, I obviously need SL 4 Runtime. Are you like me ? Don&#8217;t you like VMs for these small requirements ? </p>
<p><span id="more-120"></span></p>
<p>It took me a while to figure it out. My Solution is based on <a href="http://portableapps.com/apps/internet/firefox_portable" target="_blank">Firefox Portable</a> and these are the steps to do:</p>
<p>1. First uninstall your Silverlight 3 Runtime to be able to install Sl 4</p>
<p>2. Then Install SL 4 Runtime. You can download it from <a href="http://silverlight.net/getstarted/silverlight-4-beta/" target="_blank">Microsofts getStarted Page</a></p>
<p>3. Copy the Files C:\Program Files\Microsoft Silverlight\4.xxxxx to a temporary Folder</p>
<p>4. Uninstall Silverlight 4 and reinstall Silverlight 3. If you don&#8217;t have the Runtime at hand, you can download it <a href="http://go.microsoft.com/fwlink/?LinkID=150228" target="_blank">Here.</a> (I could not find the actual Download-Page or a Runtime-Archive. You can help me out here ?</p>
<p>5. Copy the temporary saved files to your Firefox Portable Folder under \Data\plugins</p>
<p><a href="http://assets.saschabaumann.com/images/Sl3And4Image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Where to copy the Files" border="0" alt="IMG_0002" src="http://assets.saschabaumann.com/images/Sl3And4Image1.png" /></a> </p>
<p>&#160;</p>
<p>Done that, the IE (and the Rest of the System) uses the installed SL 3 Runtime, while your Firefox Portable uses the SL 4 you copied to the Plug-in Folder. </p>
<p>The only downside is, that the Silverlight-Info within the Browser will show Version 3, cause that&#8217;s the officially&#160; installed one on the System. </p>
<p>&#160;</p>
<p><a href="http://assets.saschabaumann.com/images/Sl3And4Image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Using Sl4 but Info is still SL 3" border="0" alt="IMG_0002" src="http://assets.saschabaumann.com/images/Sl3And4Image2.png" /></a> </p>
<p>&#160;</p>
<p>Anyway, I did a few tests, and everything seems to work fine. Let me know about your experience with this.</p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/02/finally-silverlight-3-and-silverlight-4-beta-runtime-on-same-computer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve Silverlight Hittesting (Pixelbased)</title>
		<link>http://silverlightblog.saschabaumann.com/2010/01/improve-silverlight-hittesting-pixelbased/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/01/improve-silverlight-hittesting-pixelbased/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 00:53:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Various]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/2010/01/improve-silverlight-hittesting-pixelbased/</guid>
		<description><![CDATA[Many of you will know, that Silverlight 3 has a new class called WritableBitmap. We can now create Bitmaps on-the-fly.&#160; At the moment one interest of mine is Silverlight Game-programming and I thought, this class may also help to build pixel based Collision-Detection.
Guess what, I found an article from Andy Beaulieu doing exactly that:
&#34; Improved [...]]]></description>
			<content:encoded><![CDATA[<p>Many of you will know, that Silverlight 3 has a new class called WritableBitmap. We can now create Bitmaps on-the-fly.&#160; At the moment one interest of mine is Silverlight Game-programming and I thought, this class may also help to build pixel based Collision-Detection.</p>
<p>Guess what, I found an article from Andy Beaulieu doing exactly that:</p>
<p><a href="http://www.andybeaulieu.com/Home/tabid/67/EntryID/160/Default.aspx" target="_blank">&quot; Improved HitTest Method for Silverlight 3&quot; from Andy Beaulieu</a></p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/01/improve-silverlight-hittesting-pixelbased/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WCF RIA Services</title>
		<link>http://silverlightblog.saschabaumann.com/2010/01/wcf-ria-services/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/01/wcf-ria-services/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 11:48:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[WCF WIA Services]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/2010/01/wcf-ria-services/</guid>
		<description><![CDATA[Good afternoon,
one of my expectations as a Software Developer in 2010 is, that the WCF RIA Services for Silverlight will become a huge&#160; thing. So I did some research, and found a nice webcast by Ronnie Sauermann from Microsoft Switzerland. I met him during a project I did last summer, and he has a very [...]]]></description>
			<content:encoded><![CDATA[<p>Good afternoon,</p>
<p>one of my expectations as a Software Developer in 2010 is, that the WCF RIA Services for Silverlight will become a huge&#160; thing. So I did some research, and found a nice webcast by Ronnie Sauermann from Microsoft Switzerland. I met him during a project I did last summer, and he has a very good way to explain things. check it out! I unfortunately found no way to directly bookmark the video. So click the link and navigate down to Ronnies Video about RIA Services.</p>
<p><a href="http://www.microsoft.com/switzerland/shape/videos.aspx" target="_blank">Video from Shapes &#8216;09 about WCF RIA Services</a></p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/01/wcf-ria-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight Development with Eclipse &#x2013; Eclise4SL</title>
		<link>http://silverlightblog.saschabaumann.com/2010/01/silverlight-development-with-eclipse-eclise4sl/</link>
		<comments>http://silverlightblog.saschabaumann.com/2010/01/silverlight-development-with-eclipse-eclise4sl/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 11:04:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Various]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/2010/01/silverlight-development-with-eclipse-eclise4sl/</guid>
		<description><![CDATA[There is a new Kid in SL-IDE-Town, and its called Eclipse4SL. To be honest, it isn&#8217;t really new, cause development started in 2008. But end of&#160; 2009 they released Version 1.0.
The Features of this Version are:

Silverlight 2.0 support 
C# code editor with syntax colorization, keywords and template code completion assist 
Automatic Build &#38; Run 
Configurable [...]]]></description>
			<content:encoded><![CDATA[<p>There is a new Kid in SL-IDE-Town, and its called Eclipse4SL. To be honest, it isn&#8217;t really new, cause development started in 2008. But end of&#160; 2009 they released Version 1.0.</p>
<p>The Features of this Version are:</p>
<ul>
<li>Silverlight 2.0 support </li>
<li>C# code editor with syntax colorization, keywords and template code completion assist </li>
<li>Automatic Build &amp; Run </li>
<li>Configurable Web application launch facilities </li>
<li>Silverlight Project System and Silverlight Compiler: both an advanced project system for creating Silverlight applications and media experiences. </li>
<li>XAML Editor &amp; Preview: advanced, standards-compliant XAML editor with code hinting and code completion features which helps detect and correct coding errors. </li>
<li>Move and Rename refactoring </li>
<li>Advanced Media Features </li>
<li>Cross Platform Capabilities (Mac version) </li>
<li>Complete user documentation &amp; Prescriptive Tutorials </li>
<li>Defects &amp; Regression Testing </li>
<li>Developer Usability Testing </li>
</ul>
<p>&#160;</p>
<p><strong>Version 2.0 is planned for Spring 2010</strong>. This is the roadmap:</p>
<ul>
<li>Silverlight 3.0 support </li>
<li>Completion of re-organization Silverlight development environment </li>
<li>Completion of the Extensibility, Support for Multiple Projects </li>
<li>Improvements to Mac Platform </li>
<li>Completion of Silverlight 3.0 Runtime Support &quot;out of browser&quot; </li>
</ul>
<p>&#160;</p>
<p>More Information can be found on the projects website <a href="http://www.eclipse4sl.org">www.eclipse4sl.org</a></p>
<p>If you are a <strong>Mac-User</strong>, there is also a plug-in for you. Check out the <a href="http://blogs.msdn.com/interoperability/archive/2009/03/17/eclipse-tools-for-silverlight-eclipse4sl-now-for-mac-developers.aspx" target="_blank">Microsoft Interop Website for Eclipse4SL.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2010/01/silverlight-development-with-eclipse-eclise4sl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy new Year</title>
		<link>http://silverlightblog.saschabaumann.com/2009/12/frohes-neues-jahr/</link>
		<comments>http://silverlightblog.saschabaumann.com/2009/12/frohes-neues-jahr/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 11:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Various]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/2009/12/frohes-neues-jahr/</guid>
		<description><![CDATA[Hello everyone,
I wish all of you a relaxing and successful 2010. See you on the other side  )
Sascha
]]></description>
			<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>I wish all of you a relaxing and successful 2010. See you on the other side <img src='http://silverlightblog.saschabaumann.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )</p>
<p>Sascha</p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2009/12/frohes-neues-jahr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight in Webslices</title>
		<link>http://silverlightblog.saschabaumann.com/2009/12/silverlight-in-webslices/</link>
		<comments>http://silverlightblog.saschabaumann.com/2009/12/silverlight-in-webslices/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 00:02:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Various]]></category>

		<guid isPermaLink="false">http://silverlightblog.saschabaumann.com/?p=104</guid>
		<description><![CDATA[I had a little inspiration during the holidays &#8211; tried it out &#8211; and it worked.
With Internet Explorer 8 Microsoft introduced a new feature called Webslices. Little pieces of information within your browser-bar (most commonly) about site-updates.
Now I tried to put a Silverlight app into a Webslice.

 Herefor I created a new Silverlight App with [...]]]></description>
			<content:encoded><![CDATA[<p>I had a little inspiration during the holidays &#8211; tried it out &#8211; and it worked.</p>
<p>With Internet Explorer 8 Microsoft introduced a new feature called Webslices. Little pieces of information within your browser-bar (most commonly) about site-updates.</p>
<p>Now I tried to put a Silverlight app into a Webslice.
<div id='extendedEntryBreak' name='extendedEntryBreak'></div>
<p> Herefor I created a new Silverlight App with a testpage like this (created automatically)</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;form1&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;height: 100%;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;silverlightControlHost&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;object</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;application/x-shockwave-flash&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;source&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;ClientBin/SilverlightWebslice.xap&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;onError&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;onSilverlightError&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;background&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;white&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;minRuntimeVersion&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;3.0.40624.0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;autoUpgrade&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/object<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>
In my Silverlight-App I placed a Textblock saying &#8220;Welcome to my Silverlight Webslice&#8221;.
</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Grid</span> <span style="color: #000066;">x:Name</span>=<span style="color: #ff0000;">&quot;LayoutRoot&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextBlock</span> <span style="color: #000066;">Text</span>=<span style="color: #ff0000;">&quot;Welcome to my Silverlight Webslice&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/TextBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Grid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>
And then, in default.aspx I put the Webslices-Code
</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;form1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;SliceID&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;hslice&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;display: none&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;entry-title&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Silverlight Slice
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;display: none&quot;</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;entry-content&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;SilverlightWebsliceTestPage.html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Alternative<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>and voila, a silverlight Webslice.</p>
<p><a href="http://silverlightblog.saschabaumann.com/wp-content/uploads/2009/12/silverlightwebslice.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="silverlightwebslice" src="http://silverlightblog.saschabaumann.com/wp-content/uploads/2009/12/silverlightwebslice-thumb.png" border="0" alt="silverlightwebslice" width="580" height="368" /></a></p>
<p>Have fun playing arund with it <img src='http://silverlightblog.saschabaumann.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )</p>
<p>Before I forget, there is an alternative for Firefox Browser called <a href="https://addons.mozilla.org/fr/firefox/addon/8494" target="_blank">WebChunks</a>. Unfortunately it doesn&#8217;t work for the current Version at the moment, hope the developer will keep on working on it.</p>
<p>Sascha</p>
]]></content:encoded>
			<wfw:commentRss>http://silverlightblog.saschabaumann.com/2009/12/silverlight-in-webslices/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
