<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.windows-now.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Nathan Dunlap : Vectors, Styles</title><link>http://www.windows-now.com/blogs/ndunlap/archive/tags/Vectors/Styles/default.aspx</link><description>Tags: Vectors, Styles</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP2 (Build: 31104.93)</generator><item><title>Hooray for WinHEC bits!</title><link>http://www.windows-now.com/blogs/ndunlap/archive/2004/05/07/3413.aspx</link><pubDate>Fri, 07 May 2004 19:07:00 GMT</pubDate><guid isPermaLink="false">20f58a17-7e15-440c-89b3-dfe02fe74bcd:3413</guid><dc:creator>ndunlap</dc:creator><slash:comments>28</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.windows-now.com/blogs/ndunlap/rsscomments.aspx?PostID=3413</wfw:commentRss><comments>http://www.windows-now.com/blogs/ndunlap/archive/2004/05/07/3413.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Now that the SDK has been updated I can finally start posting on some of the really cool features that I have been playing with for the last couple of months. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've got an article in the works that is an updated version of my GelButton that I posted earlier. Its not finished yet, but if you want to get a sneak peek you can see the source code and screen shots here. &lt;A href="http://www.longhornblogs.com/ndunlap/articles/3392.aspx"&gt;http://www.longhornblogs.com/ndunlap/articles/3392.aspx&lt;/A&gt;&amp;nbsp; It isn't a straight port of the original GelButton demo, but I have drastically reduced the complexity of how it was created using Grid. Also I have made the drop shadow and the shines on the button much more aesthetically pleasing using the Blur&amp;nbsp;ImageEffect.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Now that the SDK is live here are some links I think are pretty exciting and interesting...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Grid &lt;BR&gt;&lt;/STRONG&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.controls/c/grid/grid.aspx"&gt;&lt;STRONG&gt;http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.controls/c/grid/grid.aspx&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/layout/overviews/grid_ovw.aspx"&gt;&lt;STRONG&gt;http://longhorn.msdn.microsoft.com/lhsdk/layout/overviews/grid_ovw.aspx&lt;/STRONG&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;BR&gt;This panel is awesome. I will admit I havent been using it enough to really feel like I have mastered its use but it really fixes the issues I blogged on earlier about not being able to do margin effects easily without doing the DockPanel.Dock=&amp;#8220;fill&amp;#8220; workaround. Grid allows you to apply NineGrid like slice and dice control on layouts that contain things other than image data. When I started using shape elements to create the visuals for my controls and applications layouts I immediately found myself wanting to have the same kind of control like I had with NineGrid. With the Grid panel I get that kind of control but I am not limited to a&amp;nbsp;nine cell configuration.&amp;nbsp;This is very cool and powerful and there are going to be some really exciting and creative designs enabled using this. I can't wait to see the different way people use this. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;ImageEffects&lt;BR&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.media/c/imageeffect/imageeffect.aspx"&gt;http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.media/c/imageeffect/imageeffect.aspx&lt;/A&gt;&lt;BR&gt;&lt;/STRONG&gt;So far the one I am using a lot is Blur. With blur&amp;nbsp;I can create some gorgeous drop shadows, on any kind of elment, text, shape, button, etc. My GelButton example is using it a lot. I've also got some cool laser effects I am doing with blur that I will be posting on.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;OpacityMasks&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/opacitymasking.aspx"&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/opacitymasking.aspx&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;Another great toy for pulling off some sweet effects. You can use gradients, images, DrawingBrushes, etc to create your masks.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=2&gt;3D&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/basic3d.aspx"&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=2&gt;http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/basic3d.aspx&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;Need I say more? Ok I will.... This changes everything. No more hard line between creating 3D content and mixing it with 2D content. I had been asking for 2D perspective transform so I could pull off pseudo 3D effects...Real 3D is so much better! Try this sometime... create an app that has 3D elements that composite on top of 2D elements like a complex layout with text flowing in it. Then composite that on top of another 3D element and hey while your at it throw a video element at the very bottom of the stack so it has to render through all that stuff. Hmm maybe throw a video element on top and set some opacity on it. Maybe even put an opacity mask on the topmost video element. Then animate a bunch of stuff. Run it full screen.&amp;nbsp;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;Its definitely&amp;nbsp;a new world we are living in! I will get some posts with cool 3D samples up soon.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;DrawingBrush in resources...&lt;/STRONG&gt;&lt;BR&gt;One note for people that have read my earlier blogs about using DrawingBrush... There are some changes with how DrawingBrush works when it is used as a resource. If your app has DrawingBrushes defined as a resource you will need to do a work around for the app to still work. I will try to post simple code soon. In the meantime you can see how I got my DrawingBrush resources working in the LoginScreen Demo &lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/sampledocs/sampleapplications/wcpsamp_demosample_loginscreen.aspx"&gt;http://longhorn.msdn.microsoft.com/lhsdk/sampledocs/sampleapplications/wcpsamp_demosample_loginscreen.aspx&lt;/A&gt;. Check out default.xaml.cs and look at the Init event. &lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;You can still &lt;FONT color=#000000&gt;use a DrawingBrush as a resource, just not as a resource before the application has loaded. Basically the first access to a DrawingBrush needs to happen before the DrawingBrush is used to render, so accessing it in the start up event causes the first access to occur before layout and render has happened. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.windows-now.com/aggbug.aspx?PostID=3413" width="1" height="1"&gt;</description><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Resources/default.aspx">Resources</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/DrawingBrush/default.aspx">DrawingBrush</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Vectors/default.aspx">Vectors</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Styles/default.aspx">Styles</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Layout/default.aspx">Layout</category></item><item><title>Reusing Vectors with Styles and def:Includes</title><link>http://www.windows-now.com/blogs/ndunlap/archive/2003/12/16/1875.aspx</link><pubDate>Wed, 17 Dec 2003 00:30:00 GMT</pubDate><guid isPermaLink="false">20f58a17-7e15-440c-89b3-dfe02fe74bcd:1875</guid><dc:creator>ndunlap</dc:creator><slash:comments>14</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.windows-now.com/blogs/ndunlap/rsscomments.aspx?PostID=1875</wfw:commentRss><comments>http://www.windows-now.com/blogs/ndunlap/archive/2003/12/16/1875.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;In my last post I mentioned that drawing brush is good when you don't want your vectors to intelligently resize and layout. So what do I do when I want to reuse vectors that I do want to dynamically resize? Well the obvious solution is to build my vector elements directly inline. The only problem is that this becomes really difficult to manage. So here are some tricks I use to avoid XAML bloat using def:include resources or styles. This allows me to use vectors as I would inline to get the benefit of layout, but I can reuse common designed elements. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I have posted an example &lt;B&gt;&lt;A href="http://www.dunlap.cc/lhblog/Vectors/ReusableVectors.zip"&gt;here&lt;/A&gt;&lt;/B&gt; that demonstrates creating a panel with a "cutout" effect.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;First, def:include resources are the most intuitive way to go, but in the PDC builds you can only use one instance of a def:include. (Don't worry, this will be fixed so that you can use it as you would expect...) &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=Arial size=2&gt;Here is how you define it:&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;lt;Canvas Width="10%" Height="10%" def:Name="MyCustomCanvas" &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle ... /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle ... /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle ... /&amp;gt;&lt;BR&gt;&amp;lt;/Canvas&amp;gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT face=Arial size=2&gt;Here is how you use it:&lt;/FONT&gt;&lt;/B&gt;&lt;FONT face="Courier New" size=2&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#000080&gt;&amp;lt;def:Include def:Content="{MyCustomCanvas}"/&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Another way of doing this is by using Style resources. ( I will be going into way more depth on how to use Styles soon. )&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT face=Arial size=2&gt;Here is how you define it:&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;lt;Style def:Name="MyCustomCanvas" &amp;gt;&lt;BR&gt;&amp;lt;Canvas Width="100%" Height="100%" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;lt;Style.VisualTree&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;Canvas Width="10%" Height="10%"&amp;nbsp; &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle ... /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle ... /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle ... /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/Canvas&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;lt;/Style.VisualTree&amp;gt;&lt;BR&gt;&amp;lt;/Style&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT face=Arial size=2&gt;Here is how you use it:&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;lt;Canvas Style="{MyCustomCanvas}" Width="80%" Height="100" Margin="10" /&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.windows-now.com/aggbug.aspx?PostID=1875" width="1" height="1"&gt;</description><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Resources/default.aspx">Resources</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Vectors/default.aspx">Vectors</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Styles/default.aspx">Styles</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Layout/default.aspx">Layout</category></item></channel></rss>