<?xml version="1.0" encoding="UTF-8"?>
<?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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>XIU's Blog</title>
	
	<link>http://xiu.shoeke.com</link>
	<description>.NET, Vidyano, WPF, Design Patterns, Ruby, Random Thoughts, ...</description>
	<lastBuildDate>Mon, 19 Jul 2010 20:53:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/xiu" /><feedburner:info uri="xiu" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Using DrawingBrush to handle transparent backgrounds</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/kEENL2PXLQk/</link>
		<comments>http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 20:52:16 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=127</guid>
		<description><![CDATA[With images it is sometimes difficult to see the difference between a white and transparent background. Using a DrawingBush in Tile mode can create the known checker background used in applications as Photoshop. &#60;DrawingBrush&#62; &#60;DrawingBrush.Drawing&#62; &#60;DrawingGroup&#62; &#60;GeometryDrawing Brush="White"&#62; &#60;GeometryDrawing.Geometry&#62; &#60;RectangleGeometry Rect="0,0,10,10" /&#62; &#8230; <a href="http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With images it is sometimes difficult to see the difference between a white and transparent background. Using a DrawingBush in Tile mode can create the known checker background used in applications as Photoshop.</p>
<pre class="brush: xml">&lt;DrawingBrush&gt;
    &lt;DrawingBrush.Drawing&gt;
        &lt;DrawingGroup&gt;
            &lt;GeometryDrawing Brush="White"&gt;
                &lt;GeometryDrawing.Geometry&gt;
                    &lt;RectangleGeometry Rect="0,0,10,10" /&gt;
                &lt;/GeometryDrawing.Geometry&gt;
            &lt;/GeometryDrawing&gt;
            &lt;GeometryDrawing Brush="LightGray"&gt;
                &lt;GeometryDrawing.Geometry&gt;
                    &lt;GeometryGroup&gt;
                        &lt;RectangleGeometry Rect="0,0,5,5" /&gt;
                        &lt;RectangleGeometry Rect="5,5,5,5" /&gt;
                    &lt;/GeometryGroup&gt;
                &lt;/GeometryDrawing.Geometry&gt;
            &lt;/GeometryDrawing&gt;
        &lt;/DrawingGroup&gt;
    &lt;/DrawingBrush.Drawing&gt;
&lt;/DrawingBrush&gt;</pre>
<p>Which will give the following effect if used as the background property.</p>
<p><img class="alignnone size-full wp-image-129" title="TransparentBackground" src="http://xiu.shoeke.com/wp-content/uploads/2010/07/TransparentBackground.png" alt="" width="143" height="134" /></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/&amp;title=Using+DrawingBrush+to+handle+transparent+backgrounds&amp;srcUrl=http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/&amp;srcTitle=Using+DrawingBrush+to+handle+transparent+backgrounds&amp;snippet=With%20images%20it%20is%20sometimes%C2%A0difficult%C2%A0to%20see%20the%20difference%20between%20a%20white%20and%20transparent%20background.%20Using%20a%20DrawingBush%20in%20Tile%20mode%20can%20create%20the%20known%20checker%20background%20used%20in%20applications%20as%20Photoshop.%0D%0A%26lt%3BDrawingBrush%26gt%3B%0D%0A%20%20%20%20%26lt%3BDrawingBrush.Drawing%26gt%3B%0D%0A%20%20%20%20%20%20%20%20%26lt%3BDrawingGroup%26gt%3B%0D" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/&amp;t=Using+DrawingBrush+to+handle+transparent+backgrounds" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Using+DrawingBrush+to+handle+transparent+backgrounds+-+File: /data/app/webapp/functions.php<br />Line: 23<br />Message: Incorrect key file for table './b2l_shrinker/phurl_settings.MYI'; try to repair it&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/i727Vmx5mYcYSbC8yQVjv1Szp0A/0/da"><img src="http://feedads.g.doubleclick.net/~a/i727Vmx5mYcYSbC8yQVjv1Szp0A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/i727Vmx5mYcYSbC8yQVjv1Szp0A/1/da"><img src="http://feedads.g.doubleclick.net/~a/i727Vmx5mYcYSbC8yQVjv1Szp0A/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/kEENL2PXLQk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/07/19/using-drawingbrush-to-handle-transparent-backgrounds/</feedburner:origLink></item>
		<item>
		<title>WPF Image Buttons</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/ovqBbcTvNGE/</link>
		<comments>http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 12:40:13 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Resizer]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=121</guid>
		<description><![CDATA[For my Resizer application I wanted a toolbar with image buttons, everything was perfect until I tried to disable the buttons. The first idea was to add a greyscale effect to the button if it was disabled. For a complete &#8230; <a href="http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For my <a href="http://resizer.codeplex.com/">Resizer</a> application I wanted a toolbar with image buttons, everything was perfect until I tried to disable the buttons. The first idea was to add a greyscale effect to the button if it was disabled. For a complete black/white icon this didn&#8217;t help either but changing the opacity does.</p>
<p><img class="alignnone size-full wp-image-124" title="Toolbar-WithDisabled" src="http://xiu.shoeke.com/wp-content/uploads/2010/07/Toolbar-WithDisabled.png" alt="" width="106" height="35" /><br />
<em>Save/Clear disabled because there are no images </em></p>
<p><img class="alignnone size-full wp-image-122" title="Toolbar-AllEnabled" src="http://xiu.shoeke.com/wp-content/uploads/2010/07/Toolbar-AllEnabled.png" alt="" width="102" height="36" /><br />
<em>All buttons enabled</em></p>
<p><img class="alignnone size-full wp-image-123" title="Toolbar-MouseOver" src="http://xiu.shoeke.com/wp-content/uploads/2010/07/Toolbar-MouseOver.png" alt="" width="103" height="33" /><br />
<em>MouseOver Save button</em></p>
<pre class="brush: xml">    &lt;Style TargetType="Button"&gt;
        &lt;Setter Property="Template"&gt;
            &lt;Setter.Value&gt;
                &lt;ControlTemplate TargetType="Button"&gt;
                    &lt;Grid Margin="1"&gt;
                        &lt;Rectangle x:Name="OuterBorder" RadiusY="2" RadiusX="2" Visibility="Collapsed"/&gt;
                        &lt;Rectangle x:Name="Bg" Fill="{TemplateBinding Background}" Margin="1" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" Visibility="Collapsed"/&gt;
                        &lt;Rectangle x:Name="InnerBorder" Margin="2" Visibility="Collapsed"/&gt;
                        &lt;ContentPresenter Margin="5" VerticalAlignment="Center" /&gt;
                    &lt;/Grid&gt;
                    &lt;ControlTemplate.Triggers&gt;
                        &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                            &lt;Setter Property="Visibility" TargetName="OuterBorder" Value="Visible"/&gt;
                            &lt;Setter Property="Visibility" TargetName="Bg" Value="Visible"/&gt;
                            &lt;Setter Property="Visibility" TargetName="InnerBorder" Value="Visible"/&gt;
                        &lt;/Trigger&gt;
                        &lt;Trigger Property="IsEnabled" Value="False"&gt;
                            &lt;Setter Property="Effect"&gt;
                                &lt;Setter.Value&gt;
                                    &lt;effects:GreyscaleEffect /&gt;
                                &lt;/Setter.Value&gt;
                            &lt;/Setter&gt;
                            &lt;Setter Property="Opacity" Value=".5" /&gt;
                        &lt;/Trigger&gt;
                    &lt;/ControlTemplate.Triggers&gt;
                &lt;/ControlTemplate&gt;
            &lt;/Setter.Value&gt;
        &lt;/Setter&gt;
    &lt;/Style&gt;</pre>
<p>And the following .fx code is used for the greyscale effect.</p>
<pre>sampler2D  ImageSampler : register(S0);  //take ImageSampler from S0 register. 

// 'uv' vector from TEXCOORD0 semantics is our texture coordinate, two floating point numbers in the range 0-1.
float4 PS( float2 uv : TEXCOORD) : COLOR
{
    float4 color = tex2D( ImageSampler, uv); // get the color of texture at the current point
    color.rgb = dot(color.rgb, float3(0.3, 0.59, 0.11)); //compose correct luminance value
    return color;
}</pre>
<p><a title="Browse Latest" href="http://resizer.codeplex.com/SourceControl/BrowseLatest">Browse the latest source</a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/&amp;title=WPF+Image+Buttons&amp;srcUrl=http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/&amp;srcTitle=WPF+Image+Buttons&amp;snippet=For%20my%20Resizer%20application%20I%20wanted%20a%20toolbar%20with%20image%20buttons%2C%20everything%20was%20perfect%20until%20I%20tried%20to%20disable%20the%20buttons.%20The%20first%20idea%20was%20to%20add%20a%20greyscale%20effect%20to%20the%20button%20if%20it%20was%20disabled.%20For%20a%20complete%20black%2Fwhite%20icon%20this%20didn%27t%20help%20either%20but%20changing%20the%20opacity%20does.%0D%0A%0D%0A%0D%0ASa" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/&amp;t=WPF+Image+Buttons" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=WPF+Image+Buttons+-+http://b2l.me/aa3mf8&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/4jIlSxsL-xUuGyqe-rYsdmwQXJ8/0/da"><img src="http://feedads.g.doubleclick.net/~a/4jIlSxsL-xUuGyqe-rYsdmwQXJ8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/4jIlSxsL-xUuGyqe-rYsdmwQXJ8/1/da"><img src="http://feedads.g.doubleclick.net/~a/4jIlSxsL-xUuGyqe-rYsdmwQXJ8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/ovqBbcTvNGE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/07/16/wpf-image-buttons/</feedburner:origLink></item>
		<item>
		<title>Updated Getting Started for Vidyano 2.0</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/q48qu8lthj4/</link>
		<comments>http://xiu.shoeke.com/2010/07/16/updated-getting-started-for-vidyano-2-0/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 10:13:59 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Vidyano]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=104</guid>
		<description><![CDATA[We have updated the Getting Started tutorial and placed it on our Wiki. Add this to Google Reader Share this on Facebook Tweet This! Post on Google Buzz]]></description>
			<content:encoded><![CDATA[<p>We have updated the <a title="Getting Started" href="http://www.vidyano.com/Wiki/Getting-Started">Getting Started</a> tutorial and placed it on our <a title="Vidyano Wiki" href="http://www.vidyano.com/Wiki/Home">Wiki</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/07/16/updated-getting-started-for-vidyano-2-0/&amp;title=Updated+Getting+Started+for+Vidyano+2.0&amp;srcUrl=http://xiu.shoeke.com/2010/07/16/updated-getting-started-for-vidyano-2-0/&amp;srcTitle=Updated+Getting+Started+for+Vidyano+2.0&amp;snippet=We%20have%20updated%20the%20Getting%20Started%20tutorial%20and%20placed%20it%20on%20our%20Wiki." rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/07/16/updated-getting-started-for-vidyano-2-0/&amp;t=Updated+Getting+Started+for+Vidyano+2.0" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Updated+Getting+Started+for+Vidyano+2.0+-+http://b2l.me/aa2ufa&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/07/16/updated-getting-started-for-vidyano-2-0/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/gDAVhs_rvLm7p1nBamMdoDrEa7Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/gDAVhs_rvLm7p1nBamMdoDrEa7Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gDAVhs_rvLm7p1nBamMdoDrEa7Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/gDAVhs_rvLm7p1nBamMdoDrEa7Y/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/q48qu8lthj4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/07/16/updated-getting-started-for-vidyano-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/07/16/updated-getting-started-for-vidyano-2-0/</feedburner:origLink></item>
		<item>
		<title>Resizing images with WPF 4.0</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/34pgu_7iIcY/</link>
		<comments>http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 22:18:34 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[Resizer]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=107</guid>
		<description><![CDATA[Microsoft changed the default behaviour for scaling images with WPF 4.0/.NET 4.0. They opted for a faster but less accurate scaling algorithm named Linear instead of the default Fant that was used in WPF 3.0. You can change this behaviour using the &#8230; <a href="http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Microsoft changed the default behaviour for scaling images with WPF 4.0/.NET 4.0.<br />
They opted for a faster but less accurate scaling algorithm named Linear instead of the default Fant that was used in WPF 3.0.</p>
<p>You can change this behaviour using the <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.renderoptions.bitmapscalingmode.aspx">RenderOptions.BitmapScalingMode</a> attached property.</p>
<pre class="brush: xml">&lt;Image Source="Image.png"
    RenderOptions.BitmapScalingMode="HighQuality" /&gt;</pre>
<p>Microsoft recommends to only use HighQuality if the image&#8217;s scaled size will be less that 30-50% of the original size.</p>
<p>The <a title="resizer.codeplex.com" href="http://resizer.codeplex.com/">Resizer </a>application will always use HighQuality so that it gives the best image quality for any image.</p>
<p>Using the attached property on images scaled in code using DrawingVisual/<a title="RenderTargetBitmap Class" href="http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.rendertargetbitmap.aspx">RenderTargetBitmap</a> requires a bit of special code.</p>
<pre class="brush: csharp">private static BitmapFrame CreateResizedImage(ImageSource source, int width, int height, int margin)
{
    var rect = new Rect(margin, margin, width - margin * 2, height - margin * 2);

    var group = new DrawingGroup();
    RenderOptions.SetBitmapScalingMode(group, BitmapScalingMode.HighQuality);
    group.Children.Add(new ImageDrawing(source, rect));

    var drawingVisual = new DrawingVisual();
    using (var drawingContext = drawingVisual.RenderOpen())
        drawingContext.DrawDrawing(group);

    var resizedImage = new RenderTargetBitmap(
        width, height,         // Resized dimensions
        96, 96,                // Default DPI values
        PixelFormats.Default); // Default pixel format
    resizedImage.Render(drawingVisual);

    return BitmapFrame.Create(resizedImage);
}</pre>
<p>Width and height contains the margin already, so if the image is scaled to 300px with a margin of 10px then the method will be called with width = 320px and margin = 10px. We can use the DrawingGroup to set the BitmapScalingMode and then add the ImageDrawing to it.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/&amp;title=Resizing+images+with+WPF+4.0&amp;srcUrl=http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/&amp;srcTitle=Resizing+images+with+WPF+4.0&amp;snippet=Microsoft%20changed%20the%20default%C2%A0behaviour%C2%A0for%20scaling%20images%20with%20WPF%204.0%2F.NET%204.0.%0D%0AThey%20opted%20for%20a%20faster%20but%20less%20accurate%20scaling%20algorithm%20named%20Linear%20instead%20of%20the%20default%20Fant%20that%20was%20used%20in%20WPF%203.0.%0D%0A%0D%0AYou%20can%20change%20this%20behaviour%20using%20the%20RenderOptions.BitmapScalingMode%20attached%20prop" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/&amp;t=Resizing+images+with+WPF+4.0" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Resizing+images+with+WPF+4.0+-+http://b2l.me/aaqqwh&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/3wZUkhAKvRmIRSGdF391ssUNr2c/0/da"><img src="http://feedads.g.doubleclick.net/~a/3wZUkhAKvRmIRSGdF391ssUNr2c/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/3wZUkhAKvRmIRSGdF391ssUNr2c/1/da"><img src="http://feedads.g.doubleclick.net/~a/3wZUkhAKvRmIRSGdF391ssUNr2c/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/34pgu_7iIcY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/07/15/resizing-images-with-wpf-4-0/</feedburner:origLink></item>
		<item>
		<title>Resizer</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/J04ceGg1YY0/</link>
		<comments>http://xiu.shoeke.com/2010/07/14/resizer/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 03:52:10 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[Resizer]]></category>
		<category><![CDATA[Vidyano]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=96</guid>
		<description><![CDATA[I&#8217;ve been working on a little project to demo the features of Vidyano. It&#8217;s used internally to generate the thumbnails for our Wiki. The source code is available on codeplex and the application is deployed as click-once. I&#8217;ll be talking about &#8230; <a href="http://xiu.shoeke.com/2010/07/14/resizer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a little project to demo the features of <a href="http://www.vidyano.com/">Vidyano</a>.<a href="http://xiu.shoeke.com/wp-content/uploads/2010/07/PreviewResizer.png"><img class="alignnone size-full wp-image-97" title="Resizer Preview" src="http://xiu.shoeke.com/wp-content/uploads/2010/07/PreviewResizer.png" alt="" width="620" height="527" /></a></p>
<p>It&#8217;s used internally to generate the thumbnails for our <a href="http://www.vidyano.com/Wiki/Home">Wiki</a>. The source code is available on <a href="http://resizer.codeplex.com/">codeplex</a> and the application is deployed as <a href="http://resizer.codeplex.com/releases/clickonce/">click-once</a>.</p>
<p>I&#8217;ll be talking about the specific Vidyano features and the resizing part with WPF 4 in the next blog posts.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/07/14/resizer/&amp;title=Resizer&amp;srcUrl=http://xiu.shoeke.com/2010/07/14/resizer/&amp;srcTitle=Resizer&amp;snippet=I%27ve%20been%20working%20on%20a%20little%20project%20to%20demo%20the%20features%20of%20Vidyano.%0D%0A%0D%0AIt%27s%20used%20internally%20to%20generate%20the%20thumbnails%20for%20our%20Wiki.%C2%A0The%20source%20code%20is%20available%20on%20codeplex%20and%20the%20application%20is%20deployed%20as%20click-once.%0D%0A%0D%0AI%27ll%20be%20talking%20about%20the%20specific%20Vidyano%20features%20and%20the%20resizing%20par" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/07/14/resizer/&amp;t=Resizer" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Resizer+-+http://b2l.me/aajupj&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/07/14/resizer/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/St6NT8FXH5HuPZXZ30suNgg2ZQw/0/da"><img src="http://feedads.g.doubleclick.net/~a/St6NT8FXH5HuPZXZ30suNgg2ZQw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/St6NT8FXH5HuPZXZ30suNgg2ZQw/1/da"><img src="http://feedads.g.doubleclick.net/~a/St6NT8FXH5HuPZXZ30suNgg2ZQw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/J04ceGg1YY0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/07/14/resizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/07/14/resizer/</feedburner:origLink></item>
		<item>
		<title>iRail.be is back online</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/yn4OjvQuh-0/</link>
		<comments>http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 10:43:42 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Free Internet]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=93</guid>
		<description><![CDATA[iRail.be is a website to find train information here in Belgium, it scraped the original complicated website of the NMBS and provided a clean/simple interface to access the information. More info on the blogpost. Add this to Google Reader Share &#8230; <a href="http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.irail.be/">iRail.be</a> is a website to find train information here in Belgium, it scraped the original complicated website of the NMBS and provided a clean/simple interface to access the information.</p>
<p>More info on the <a href="http://blog.tuinslak.org/2010/07/irail-is-back/">blogpost</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/&amp;title=iRail.be+is+back+online&amp;srcUrl=http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/&amp;srcTitle=iRail.be+is+back+online&amp;snippet=iRail.be%20is%20a%20website%20to%20find%20train%20information%20here%20in%20Belgium%2C%20it%20scraped%20the%20original%20complicated%20website%20of%20the%20NMBS%20and%20provided%20a%20clean%2Fsimple%20interface%20to%20access%20the%20information.%0D%0A%0D%0AMore%20info%20on%20the%20blogpost." rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/&amp;t=iRail.be+is+back+online" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=iRail.be+is+back+online+-+File: /data/app/webapp/functions.php<br />Line: 66<br />Message: Duplicate entry '873bT' for key 'code'&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/aDCxBmD3N8qwoOh2YsQ8hvTTgl8/0/da"><img src="http://feedads.g.doubleclick.net/~a/aDCxBmD3N8qwoOh2YsQ8hvTTgl8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/aDCxBmD3N8qwoOh2YsQ8hvTTgl8/1/da"><img src="http://feedads.g.doubleclick.net/~a/aDCxBmD3N8qwoOh2YsQ8hvTTgl8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/yn4OjvQuh-0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/07/06/irail-be-is-back-online/</feedburner:origLink></item>
		<item>
		<title>Vidyano 2.0 released</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/5IvpYWPpxD4/</link>
		<comments>http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 13:42:17 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[MEF]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Reactive Extensions]]></category>
		<category><![CDATA[Vidyano]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=86</guid>
		<description><![CDATA[I&#8217;m proud to announce that our team has finished our next major version of Vidyano. Build from scratch to optimize everything for the latest .NET 4.0 release and using all latest features of it (MEF, Rx, &#8230;). The User Interface &#8230; <a href="http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m proud to announce that our team has finished our next major version of Vidyano.<br />
Build from scratch to optimize everything for the latest .NET 4.0 release and using all latest features of it (MEF, Rx, &#8230;).<br />
The User Interface now uses a MVVM based architecture with our Module/Page system on top of it.</p>
<p>You can download it directly from inside Visual Studio using the Extension Manager or at the <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/8367485B-8372-4B44-A118-3C40B8EA9C15">Visual Studio Gallery Page</a>.</p>
<p>Read more on our <a href="http://blog.vidyano.com/post/Vidyano-20-now-available-on-the-Microsoft-Visual-Studio-Extension-Gallery.aspx">blog</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/&amp;title=Vidyano+2.0+released&amp;srcUrl=http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/&amp;srcTitle=Vidyano+2.0+released&amp;snippet=I%27m%20proud%20to%20announce%20that%20our%20team%20has%20finished%20our%20next%20major%20version%20of%20Vidyano.%0D%0ABuild%20from%20scratch%20to%20optimize%20everything%20for%20the%20latest%20.NET%204.0%20release%20and%20using%20all%20latest%20features%20of%20it%20%28MEF%2C%20Rx%2C%20...%29.%0D%0AThe%20User%20Interface%20now%20uses%20a%20MVVM%20based%20architecture%20with%20our%20Module%2FPage%20system%20on%20top" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/&amp;t=Vidyano+2.0+released" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Vidyano+2.0+released+-+http://b2l.me/74cn2&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/7znWzgpiZV0UAz7SU044ubK62lY/0/da"><img src="http://feedads.g.doubleclick.net/~a/7znWzgpiZV0UAz7SU044ubK62lY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7znWzgpiZV0UAz7SU044ubK62lY/1/da"><img src="http://feedads.g.doubleclick.net/~a/7znWzgpiZV0UAz7SU044ubK62lY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/5IvpYWPpxD4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/</feedburner:origLink></item>
		<item>
		<title>.NET 4.0</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/Lrm2w8q7l-o/</link>
		<comments>http://xiu.shoeke.com/2010/06/20/net-40/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 13:56:46 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
		
		<guid isPermaLink="false">http://xiu.shoeke.com/?p=75</guid>
		<description><![CDATA[Some updated download links for the latest .NET version: Microsoft .NET Framework 4 (Web Installer) Microsoft Visual Studio 2010 Express Downloads Microsoft Web Platform Installer 2.0 Microsoft Expression Blend® 4 Reactive Extensions for .NET (Rx) Snoop WPF4 .NET Reflector Vidyano &#8230; <a href="http://xiu.shoeke.com/2010/06/20/net-40/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some updated download links for the latest .NET version:</p>
<ul>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992&#038;displaylang=en">Microsoft .NET Framework 4 (Web Installer)</a></li>
<li><a href="http://www.microsoft.com/express/downloads/">Microsoft Visual Studio 2010 Express Downloads</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=145505">Microsoft Web Platform Installer 2.0</a></li>
<li><a href="http://www.microsoft.com/expression/products/blend_overview.aspx">Microsoft Expression Blend® 4</a></li>
<li><a href="http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx">Reactive Extensions for .NET (Rx)</a></li>
<li><a href="http://snoopwpf.codeplex.com/releases/view/45696">Snoop WPF4</a></li>
<li><a href="http://www.red-gate.com/products/reflector/">.NET Reflector</a></li>
<li><a href="http://visualstudiogallery.msdn.microsoft.com/en-us/8367485b-8372-4b44-a118-3c40b8ea9c15">Vidyano 2.0</a></li>
</ul>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/06/20/net-40/&amp;title=.NET+4.0&amp;srcUrl=http://xiu.shoeke.com/2010/06/20/net-40/&amp;srcTitle=.NET+4.0&amp;snippet=Some%20updated%20download%20links%20for%20the%20latest%20.NET%20version%3A%0D%0A%0D%0A%09Microsoft%20.NET%20Framework%204%20%28Web%20Installer%29%0D%0A%09Microsoft%20Visual%20Studio%202010%20Express%20Downloads%0D%0A%09Microsoft%20Web%20Platform%20Installer%202.0%0D%0A%09Microsoft%20Expression%20Blend%C2%AE%204%0D%0A%09Reactive%20Extensions%20for%20.NET%20%28Rx%29%0D%0A%09Snoop%20WPF4%0D%0A%09.NET%20Reflector%0D%0A%09Vidyano" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/06/20/net-40/&amp;t=.NET+4.0" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=.NET+4.0+-+http://b2l.me/74cux&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/06/20/net-40/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/j2N7pylHKuTbNM8PGQi3u085z90/0/da"><img src="http://feedads.g.doubleclick.net/~a/j2N7pylHKuTbNM8PGQi3u085z90/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/j2N7pylHKuTbNM8PGQi3u085z90/1/da"><img src="http://feedads.g.doubleclick.net/~a/j2N7pylHKuTbNM8PGQi3u085z90/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/Lrm2w8q7l-o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/06/20/net-40/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/06/20/net-40/</feedburner:origLink></item>
		<item>
		<title>Rails dynamic finders for .NET 4.0</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/i2CKkEmOXmU/</link>
		<comments>http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 13:40:18 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
		
		<guid isPermaLink="false">http://xiu.shoeke.com/?p=70</guid>
		<description><![CDATA[Ruby on Rails allows you to use &#8216;dynamic&#8217; finders to query the database. This is actually a feature from ActiveRecord to dynamicly use methods which will represent where clauses on the database. Some examples: User.find(:first, :conditions =&#62; ["name = ?", &#8230; <a href="http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ruby on Rails allows you to use &#8216;dynamic&#8217; finders to query the database. This is actually a feature from ActiveRecord to dynamicly use methods which will represent where clauses on the database.</p>
<p>Some examples:</p>
<pre class="brush: ruby">User.find(:first, :conditions =&gt; ["name = ?", name])
User.find_by_name(name)

User.find(:all, :conditions =&gt; ["city = ?", city])
User.find_all_by_city(city)

User.find(:all, :conditions =&gt; ["street = ? AND city IN (?)", street, cities])
User.find_all_by_street_and_city(street, cities)</pre>
<p>With .NET 4.0 we have dynamics of our own so I thought why not recreate this feature&#8230;</p>
<p>By creating an extension method for IEnumerable&lt;T&gt; and IQueryable&lt;T&gt; each enumerable source can now use the dynamic finder feature</p>
<pre class="brush: csharp">public static class DynamicExtensions
{
    public static dynamic AsDynamic&lt;T&gt;(this IEnumerable&lt;T&gt; source)
    {
        return new DynamicEnumerable&lt;T&gt;(source);
    }

    public static dynamic AsDynamic&lt;T&gt;(this IQueryable&lt;T&gt; source)
    {
        return new DynamicQueryable&lt;T&gt;(source);
    }
}</pre>
<p>The Dynamic classes will inherit from DynamicObject to give basic dynamics support.</p>
<pre class="brush: csharp">sealed class DynamicQueryable&lt;T&gt; : DynamicObject
{
    private readonly IQueryable&lt;T&gt; source;

    public DynamicQueryable(IQueryable&lt;T&gt; source)
    {
        this.source = source;
    }

    public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
    {
        var match = methodMatcher.Match(binder.Name);
        if (match.Success)
        {
            var properties = match.Groups[2].Value.Split(new[] { "And" }, StringSplitOptions.RemoveEmptyEntries);
            var predicate = BuildExpression&lt;T&gt;(properties, args);

            if (match.Groups[1].Success)
                result = source.Where(predicate);
            else
                result = source.FirstOrDefault(predicate);

            return true;
        }
        return base.TryInvokeMember(binder, args, out result);
    }
}</pre>
<p>With the only missing part the BuildExpression method which will create the expression tree:</p>
<pre class="brush: csharp">private static Expression&lt;Func&lt;T, bool&gt;&gt; BuildExpression&lt;T&gt;(string[] properties, object[] args)
{
    if (properties.Length &lt; 1)
       throw new InvalidOperationException("Need to specify at least one property.");
    if (args.Length != properties.Length)
       throw new InvalidOperationException("Method expects " + properties.Length + " parameters and only got " + args.Length + " values.");

    var param = Expression.Parameter(typeof(T), "p");
    var body = Expression.Equal(Expression.Property(param, properties[0]), Expression.Constant(args[0]));
    for (var i = 1; i &lt; properties.Length; i++)
        body = Expression.AndAlso(body, Expression.Equal(Expression.Property(param, properties[i]), Expression.Constant(args[i])));
    return Expression.Lambda&lt;Func&lt;T, bool&gt;&gt;(body, param);
}</pre>
<p>And the only difference with the DynamicEnumerable class is that the expression will be compiled to use for the Where/FirstOrDefault.</p>
<p>Full source at <a title="http://pastebin.com/m6FmvUGj" href="http://pastebin.com/m6FmvUGj">pastebin</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/&amp;title=Rails+dynamic+finders+for+.NET+4.0&amp;srcUrl=http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/&amp;srcTitle=Rails+dynamic+finders+for+.NET+4.0&amp;snippet=Ruby%20on%20Rails%20allows%20you%20to%20use%20%27dynamic%27%20finders%20to%20query%20the%20database.%20This%20is%20actually%20a%20feature%20from%20ActiveRecord%20to%20dynamicly%20use%20methods%20which%20will%20represent%20where%20clauses%20on%20the%20database.%0D%0A%0D%0ASome%20examples%3A%0D%0AUser.find%28%3Afirst%2C%20%3Aconditions%20%3D%26gt%3B%20%5B%22name%20%3D%20%3F%22%2C%20name%5D%29%0D%0AUser.find_by_name%28name%29%0D%0A%0D%0AUs" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/&amp;t=Rails+dynamic+finders+for+.NET+4.0" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Rails+dynamic+finders+for+.NET+4.0+-+http://b2l.me/74cuh&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/DvCFdrY5Ai2Z3TGRqxOrI9qb5HQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/DvCFdrY5Ai2Z3TGRqxOrI9qb5HQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/DvCFdrY5Ai2Z3TGRqxOrI9qb5HQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/DvCFdrY5Ai2Z3TGRqxOrI9qb5HQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/i2CKkEmOXmU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2010/06/19/rails-dynamic-finders-for-net-40/</feedburner:origLink></item>
		<item>
		<title>Vidyano Release Candidate</title>
		<link>http://feedproxy.google.com/~r/xiu/~3/ILuOmyxorbI/</link>
		<comments>http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 15:03:09 +0000</pubDate>
		<dc:creator>XIU</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Vidyano]]></category>

		<guid isPermaLink="false">http://xiu.shoeke.com/?p=67</guid>
		<description><![CDATA[UPDATE: Vidyano 2.0 released The Vidyano Release Candidate is now available Together with a new website we offer complete support now for any application build with Vidyano, think of it as a Go Live license. More information (including documentation, tutorials &#8230; <a href="http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong> <a title="Vidyano 2.0 released" href="http://xiu.shoeke.com/2010/07/01/vidyano-2-0-released/">Vidyano 2.0 released</a></p>
<p>The Vidyano Release Candidate is now available <img src='http://xiu.shoeke.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Together with a new website we offer complete support now for any application build with Vidyano, think of it as a Go Live license.</p>
<p>More information (including documentation, tutorials and downloads) at:</p>
<p><a href="http://www.vidyano.com/">http://www.vidyano.com/</a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr">
<ul class="socials">
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/&amp;title=Vidyano+Release+Candidate&amp;srcUrl=http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/&amp;srcTitle=Vidyano+Release+Candidate&amp;snippet=UPDATE%3A%20Vidyano%202.0%20released%0D%0A%0D%0AThe%20Vidyano%20Release%20Candidate%20is%20now%20available%20%3A%29%0D%0A%0D%0ATogether%20with%20a%20new%20website%20we%20offer%20complete%20support%20now%20for%20any%20application%20build%20with%20Vidyano%2C%20think%20of%20it%20as%20a%20Go%20Live%20license.%0D%0A%0D%0AMore%20information%20%28including%20documentation%2C%20tutorials%20and%20downloads%29%20at%3A%0D%0A%0D%0Ahttp%3A" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/&amp;t=Vidyano+Release+Candidate" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Vidyano+Release+Candidate+-+http://b2l.me/74cxh&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>


<p><a href="http://feedads.g.doubleclick.net/~a/qkx-jFzDFHSX6jiuF5lNbnL4gcE/0/da"><img src="http://feedads.g.doubleclick.net/~a/qkx-jFzDFHSX6jiuF5lNbnL4gcE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qkx-jFzDFHSX6jiuF5lNbnL4gcE/1/da"><img src="http://feedads.g.doubleclick.net/~a/qkx-jFzDFHSX6jiuF5lNbnL4gcE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/xiu/~4/ILuOmyxorbI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://xiu.shoeke.com/2008/11/30/vidyano-release-candidate/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.628 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-07-23 08:23:35 -->
