<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7582189321845048092</id><updated>2012-02-16T17:40:58.489-05:00</updated><category term='Windows Phone 7'/><category term='VSTO'/><category term='ClickOnce'/><category term='Windows Media Center'/><category term='WPF'/><category term='API'/><category term='Reg-Free COM'/><category term='Open Source'/><category term='.NET'/><category term='Silverlight'/><title type='text'>stack.push</title><subtitle type='html'>an unorganized heap of dev-related stuff</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-4455705938947504452</id><published>2011-09-14T23:00:00.012-04:00</published><updated>2011-09-15T13:23:01.377-04:00</updated><title type='text'>Random tips for Windows 8 / WinRT</title><content type='html'>&lt;strong&gt;Check if you're in the designer:&lt;/strong&gt;&lt;br /&gt;
bool Windows.ApplicationModel.DesignMode.DesignModeEnabled&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Reflection:&lt;/strong&gt;&lt;br /&gt;
Cast Type object to IReflectableType (maybe do an "as" and check for null?), and call IReflectableType.GetTypeInfo(). TypeInfo has access to members and properties and such.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;XAML namespace declaration:&lt;/strong&gt;&lt;br /&gt;
The old way looked like this:&lt;br /&gt;
&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;local&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;="clr-namespace:SharkDice"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Now, use "using:": &lt;br /&gt;
&lt;strong&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: red; font-family: Consolas; font-size: x-small;"&gt;local&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: blue; font-family: Consolas; font-size: x-small;"&gt;="using:SharkDice"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Dispatcher (to invoke on UI thread):&lt;/strong&gt;&lt;br /&gt;
Window.Current.CoreWindow.Dispatcher&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;ViewModels / MVVM / INotifyPropertyChanged:&lt;/strong&gt;&lt;br /&gt;
None of the sample code uses MVVM, which is a little scary. Apparently INotifyPropertyChanged exists in System.ComponentModel and Windows.UI.Xaml.Data, but the only sample that uses either uses Windows.UI.Xaml.Data. Sometimes it gets a little weird and won't build though. Make sure everything builds and works correctly before you implement.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Event Accessors:&lt;/strong&gt;&lt;br /&gt;
I couldn't get event accessors (add / remove) to work at all. Got some very strange build issues.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;VS2011 XAML Design Surface Failure:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span lang="EN"&gt;&lt;div align="LEFT" dir="LTR"&gt;&lt;em&gt;System.Runtime.Remoting.RemotingException&lt;/em&gt;&lt;/div&gt;&lt;em&gt; &lt;/em&gt;&lt;br /&gt;
&lt;div align="LEFT" dir="LTR"&gt;&lt;em&gt;[3928] Designer process terminated unexpectedly!&lt;/em&gt;&lt;/div&gt;&lt;div align="LEFT" dir="LTR"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align="LEFT" dir="LTR"&gt;Sometimes I get this error when I've written bad XAML, but twice I've put Visual Studio in a state where the designer is just permanently broken. I can open the same project on another Win8 machine and it works, but no amount of restarts, Cleans, etc. will bring back the design surface. For this reason I recommend doing dev work in a virtual machine or something you can easily and quickly recover or restore without losing your work.&lt;/div&gt;&lt;div align="LEFT" dir="LTR"&gt;NOTE: Doing a "refresh" (Metro Control Panel -&amp;gt; General -&amp;gt; Refresh your PC) fixed Visual Studio for me, but it was painful as I lost all my installed apps and some settings).&lt;/div&gt;&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
&lt;strong&gt;Things of question / note:&lt;/strong&gt; &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Why can Blend Preview only open HTML / JavaScript projects? Currently no easy way to edit templates and storyboards.&lt;/li&gt;
&lt;li&gt;How to embed custom fonts? Silverlight and WPF methods don't work.&lt;/li&gt;
&lt;li&gt;Replacement for Silverlight Projection? (Sad this is gone as I always hated that it wasn't in WPF)&lt;/li&gt;
&lt;li&gt;Where is IsolatedStorage equivalent?&lt;/li&gt;
&lt;li&gt;Where is non-generic IDictionary or equivalent?&lt;/li&gt;
&lt;li&gt;Is there a replacement for Application.ApplicationLifetimeObjects? (not hard to replicate ourselves)&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-4455705938947504452?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/4455705938947504452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2011/09/random-tips-for-windows-8-winrt.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/4455705938947504452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/4455705938947504452'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2011/09/random-tips-for-windows-8-winrt.html' title='Random tips for Windows 8 / WinRT'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-3315629828328999104</id><published>2010-03-22T21:10:00.003-04:00</published><updated>2010-03-22T21:10:59.388-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Phone 7'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Windows Phone 7 Application Bar Templates</title><content type='html'>I created templates for the Application Bar images for myself and I'm sharing them in case they would be useful to anyone else. Here are the PSD and PNGs:&lt;br /&gt;
The PSD is broken up into layers so you can easily hide the template to save off your icon. Just stay within the white square on either template (inner 26x26) and you should be good to go.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://cid-27c22899419e6236.skydrive.live.com/self.aspx/.Public/AppBarIconTemplate.png"&gt;http://cid-27c22899419e6236.skydrive.live.com/self.aspx/.Public/AppBarIconTemplate.png&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://cid-27c22899419e6236.skydrive.live.com/self.aspx/.Public/AppBarIconTemplate.psd"&gt;http://cid-27c22899419e6236.skydrive.live.com/self.aspx/.Public/AppBarIconTemplate.psd&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-3315629828328999104?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/3315629828328999104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2010/03/windows-phone-7-application-bar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/3315629828328999104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/3315629828328999104'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2010/03/windows-phone-7-application-bar.html' title='Windows Phone 7 Application Bar Templates'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-4303696617767290406</id><published>2010-03-22T21:05:00.004-04:00</published><updated>2010-03-22T21:27:18.447-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Media Center'/><category scheme='http://www.blogger.com/atom/ns#' term='Open Source'/><title type='text'>Boxee Launcher</title><content type='html'>Started another new Codeplex project: &lt;a href="http://boxeelauncher.codeplex.com/"&gt;http://boxeelauncher.codeplex.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This is the sibling of &lt;a href="http://hululauncher.codeplex.com/"&gt;Hulu Launcher&lt;/a&gt;.&amp;nbsp;Boxee Launcher is a simple Windows Media Center add-in that attempts to launch&amp;nbsp;Boxee and manage the windows as seamlessly as possible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-4303696617767290406?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/4303696617767290406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2010/03/boxee-launcher.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/4303696617767290406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/4303696617767290406'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2010/03/boxee-launcher.html' title='Boxee Launcher'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-5679079028608518141</id><published>2010-03-15T22:11:00.001-04:00</published><updated>2010-03-22T21:27:40.442-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Media Center'/><category scheme='http://www.blogger.com/atom/ns#' term='Open Source'/><title type='text'>Hulu Launcher</title><content type='html'>Started a new Codeplex project: &lt;a href="http://hululauncher.codeplex.com/"&gt;http://hululauncher.codeplex.com/&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Hulu Launcher is a simple Windows Media Center add-in that attempts to launch Hulu Desktop and manage the windows as seamlessly as possible.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Check it out if you're into that sort of thing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-5679079028608518141?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/5679079028608518141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2010/03/hulu-launcher.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/5679079028608518141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/5679079028608518141'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2010/03/hulu-launcher.html' title='Hulu Launcher'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-5948309435720164331</id><published>2010-03-05T18:46:00.000-05:00</published><updated>2010-03-05T18:46:39.502-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ClickOnce'/><category scheme='http://www.blogger.com/atom/ns#' term='VSTO'/><category scheme='http://www.blogger.com/atom/ns#' term='Reg-Free COM'/><title type='text'>How to Create and Modify ClickOnce Manifests</title><content type='html'>Working with ClickOnce manifests can be a pain, especially if you need to integrate that work into your build process. There are several tools you can work with and potentially automate.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;mage.exe&lt;/strong&gt; - This is the backing process behind mage.ui. In my opinion, mage.exe is the next step up from the "Publish" tab in Visual Studio -- it works, but only for basic cases. Comes with the .NET SDK.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;mt.exe&lt;/strong&gt; - This is a great little tool that can validate, sign, and update the hashes in&amp;nbsp;your manifests. It can also merge manifests and dump manifests from executables, as well as extract COM information to generate your own Reg-Free COM information (better than the Visual Studio build process does, actually -- most of our Reg-Free COM manifests are manually built with mt.exe).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Microsoft.Build.Tasks.Deployment.ManifestUtilities&lt;/strong&gt;&amp;nbsp;- This namespace is a god-send, although it doesn't work with VSTO deployment manifests (in fact, it will probably mangle them). I believe the Visual Studio build process uses these classes internally, but I'm not sure. You can use this to modify&amp;nbsp;application and deployment manifests in just about any way imaginable.&amp;nbsp;To get access to this, add a reference to the &lt;strong&gt;Microsoft.Build.Tasks&lt;/strong&gt; assembly.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
To read a manifest using this, start at &lt;strong&gt;ManifestReader.ReadManifest(path)&lt;/strong&gt; and work from there.&lt;br /&gt;
To sign your manifests (or other files) from code, take a look at &lt;strong&gt;SecurityUtilities.SignFile(certThumbprint, timestampUrl, path)&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-5948309435720164331?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/5948309435720164331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2010/03/how-to-create-and-modify-clickonce.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/5948309435720164331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/5948309435720164331'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2010/03/how-to-create-and-modify-clickonce.html' title='How to Create and Modify ClickOnce Manifests'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-3640794588392448729</id><published>2010-02-27T11:23:00.003-05:00</published><updated>2010-02-28T09:52:58.325-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>{x:Static} Replacement in Silverlight</title><content type='html'>&lt;span xmlns=""&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Times New Roman; font-size: 12pt;"&gt;So, there's no {x:Static} in Silverlight. That kind of sucks. I wrote this value converter to try to get around that. &lt;em&gt;Unlike&lt;/em&gt; {x:Static}, you should put the whole path in the Source and avoid using the Binding.Path property. The converter should parse everything as needed. The code below doesn't support indexers of any kind, but it wouldn't be too hard to add.&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times New Roman; font-size: 12pt;"&gt;You can use it in your XAML like this: &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;&amp;lt;&lt;span style="color: #a31515;"&gt;local&lt;span style="color: blue;"&gt;:&lt;span style="color: #a31515;"&gt;BlockContainer&lt;span style="color: red;"&gt; Blocks&lt;span style="color: blue;"&gt;="{&lt;span style="color: #a31515;"&gt;Binding&lt;span style="color: red;"&gt; Source&lt;span style="color: blue;"&gt;=Cubus.Game.CubusGame.Current.CurrentPlayer.Blocks,&lt;span style="color: red;"&gt; Converter&lt;span style="color: blue;"&gt;={&lt;span style="color: #a31515;"&gt;StaticResource&lt;span style="color: red;"&gt; static&lt;span style="color: blue;"&gt;}}"/&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Times New Roman; font-size: 12pt;"&gt;Here's the class. My apologies for the formatting.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;span style="font-family: Times New Roman; font-size: 12pt;"&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;StaticConverter&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;IValueConverter&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;#region&lt;/span&gt; IValueConverter Members &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;object&lt;/span&gt; Convert(&lt;span style="color: blue;"&gt;object&lt;/span&gt; value, &lt;span style="color: #2b91af;"&gt;Type&lt;/span&gt; targetType, &lt;span style="color: blue;"&gt;object&lt;/span&gt; parameter, System.Globalization.&lt;span style="color: #2b91af;"&gt;CultureInfo&lt;/span&gt; culture) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (!(value &lt;span style="color: blue;"&gt;is&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt;)) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;throw&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ArgumentException&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"Value must be of type string."&lt;/span&gt;); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;try&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; staticValue = (&lt;span style="color: blue;"&gt;string&lt;/span&gt;)value; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// First we need to find the type&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; typeName = &lt;span style="color: blue;"&gt;null&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: #2b91af;"&gt;Type&lt;/span&gt; type = &lt;span style="color: blue;"&gt;null&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;int&lt;/span&gt; periodIndex = &lt;span style="color: brown;"&gt;0&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;int&lt;/span&gt; lastPeriodIndex = staticValue.LastIndexOf(&lt;span style="color: #a31515;"&gt;"."&lt;/span&gt;); &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;while&lt;/span&gt; (type == &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; periodIndex &amp;lt; lastPeriodIndex) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;periodIndex = staticValue.IndexOf(&lt;span style="color: #a31515;"&gt;"."&lt;/span&gt;, periodIndex + &lt;span style="color: brown;"&gt;1&lt;/span&gt;); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;typeName = staticValue.Substring(&lt;span style="color: brown;"&gt;0&lt;/span&gt;, periodIndex); &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// This bizarre block of code is how you enumerate through &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// loaded assemblies in Silverlight. Normally you'd use&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// AppDomain.Current.GetAssemblies() or something like that.&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;AssemblyPart&lt;/span&gt; ap &lt;span style="color: blue;"&gt;in&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Deployment&lt;/span&gt;.Current.Parts) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;System.Windows.Resources.&lt;span style="color: #2b91af;"&gt;StreamResourceInfo&lt;/span&gt; sri = &lt;span style="color: #2b91af;"&gt;Application&lt;/span&gt;.GetResourceStream(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Uri&lt;/span&gt;(ap.Source, &lt;span style="color: #2b91af;"&gt;UriKind&lt;/span&gt;.Relative)); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;System.Reflection.&lt;span style="color: #2b91af;"&gt;Assembly&lt;/span&gt; assembly = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;AssemblyPart&lt;/span&gt;().Load(sri.Stream); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;type = assembly.GetType(typeName); &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (type != &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;break&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (type == &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;throw&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;NullReferenceException&lt;/span&gt;(&lt;span style="color: blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515;"&gt;"No type was found matching the name {0}."&lt;/span&gt;, typeName)); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// Now let's find the value.&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// After the type name, the first part of the path&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// should be a static member. After that, the rest&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: green;"&gt;// should be instance members.&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;object&lt;/span&gt; workingValue = &lt;span style="color: blue;"&gt;null&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: #2b91af;"&gt;Type&lt;/span&gt; workingType = type; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;[] path = staticValue.Substring(periodIndex + &lt;span style="color: brown;"&gt;1&lt;/span&gt;, staticValue.Length - (periodIndex + &lt;span style="color: brown;"&gt;1&lt;/span&gt;)) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;.Split(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt;[] { &lt;span style="color: #a31515;"&gt;"."&lt;/span&gt; }, &lt;span style="color: #2b91af;"&gt;StringSplitOptions&lt;/span&gt;.None); &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;for&lt;/span&gt; (&lt;span style="color: blue;"&gt;int&lt;/span&gt; i = &lt;span style="color: brown;"&gt;0&lt;/span&gt;; i &amp;lt; path.Length; i++) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt; flags; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (i == &lt;span style="color: brown;"&gt;0&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;flags = (&lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.Static | &lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.GetProperty | &lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.GetField | &lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.Public); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;flags = (&lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.Instance | &lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.GetProperty | &lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.GetField | &lt;span style="color: #2b91af;"&gt;BindingFlags&lt;/span&gt;.Public); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: #2b91af;"&gt;PropertyInfo&lt;/span&gt; propInfo = workingType.GetProperty(path[i], flags); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (propInfo != &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;workingValue = propInfo.GetValue(workingValue, &lt;span style="color: blue;"&gt;null&lt;/span&gt;); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: #2b91af;"&gt;FieldInfo&lt;/span&gt; fieldInfo = workingType.GetField(path[i], flags); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (fieldInfo != &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;workingValue = fieldInfo.GetValue(workingValue); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;throw&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;NullReferenceException&lt;/span&gt;(&lt;span style="color: blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515;"&gt;"No properties or fields were found matching the name {0}."&lt;/span&gt;, path[i])); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;workingType = workingValue.GetType(); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; workingValue; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;catch&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;DesignerProperties&lt;/span&gt;.GetIsInDesignMode(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;UserControl&lt;/span&gt;())) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;DependencyProperty&lt;/span&gt;.UnsetValue; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;throw&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;object&lt;/span&gt; ConvertBack(&lt;span style="color: blue;"&gt;object&lt;/span&gt; value, &lt;span style="color: #2b91af;"&gt;Type&lt;/span&gt; targetType, &lt;span style="color: blue;"&gt;object&lt;/span&gt; parameter, System.Globalization.&lt;span style="color: #2b91af;"&gt;CultureInfo&lt;/span&gt; culture) &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;throw&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;NotImplementedException&lt;/span&gt;(); &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;#endregion&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Consolas; font-size: 9pt;"&gt;} &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-3640794588392448729?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/3640794588392448729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2010/02/xstatic-replacement-in-silverlight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/3640794588392448729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/3640794588392448729'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2010/02/xstatic-replacement-in-silverlight.html' title='{x:Static} Replacement in Silverlight'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-1045330871493135266</id><published>2010-02-27T11:08:00.004-05:00</published><updated>2010-02-28T09:51:47.993-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Things in WPF that I wish were in Silverlight</title><content type='html'>&lt;ul&gt;&lt;li&gt;{x:Static}&lt;/li&gt;
&lt;li&gt;MultiBinding&lt;/li&gt;
&lt;li&gt;Custom markup extensions&lt;/li&gt;
&lt;li&gt;PropertyMetadata overrides&lt;/li&gt;
&lt;li&gt;Adorners&lt;/li&gt;
&lt;li&gt;Faster hit-testing&lt;/li&gt;
&lt;li&gt;The Mouse class, being able to check mouse state without setting flags all over the place.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-1045330871493135266?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/1045330871493135266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2010/02/things-in-wpf-that-i-wish-were-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/1045330871493135266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/1045330871493135266'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2010/02/things-in-wpf-that-i-wish-were-in.html' title='Things in WPF that I wish were in Silverlight'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-2985614186792696134</id><published>2010-02-27T11:02:00.002-05:00</published><updated>2010-03-05T16:52:40.231-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ClickOnce'/><category scheme='http://www.blogger.com/atom/ns#' term='VSTO'/><category scheme='http://www.blogger.com/atom/ns#' term='Reg-Free COM'/><title type='text'>Reg-Free COM in VSTO Applications, Part 2</title><content type='html'>A simple test did have us using the Activation Context API to load a COM object in Word, however we never could get it working with a more advanced solution, such as ActiveX controls. The results of the basic test show that this should be possible, but for now this is on the back-burner. Someone with a very advanced knowledge of manifests and SxS should be able to get this set up.&lt;br /&gt;
&lt;br /&gt;
From a high-level view, there are two things you need to do:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;P/Invoke the &lt;a href="http://msdn.microsoft.com/en-us/library/aa376620(VS.85).aspx"&gt;Activation Context API&lt;/a&gt;, and use it to load the manifest that your reg-free COM information is in (usually it's Native.[assemblyname].manifest) during the startup of your VSTO add-in.&lt;/li&gt;
&lt;li&gt;The VSTO build process will not include your Native.[assemblyname].manifest in the Application Manifest, so you'll have to add it yourself. Since I wrote it at work I can't share our method, but we ended up creating a command-line tool that runs as a post-build step and manually adds the file reference&amp;nbsp;using XmlDocument, and re-hashes and re-signs everything.&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-2985614186792696134?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/2985614186792696134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2010/02/reg-free-com-in-vsto-applications-part.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/2985614186792696134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/2985614186792696134'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2010/02/reg-free-com-in-vsto-applications-part.html' title='Reg-Free COM in VSTO Applications, Part 2'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-4095530233234053168</id><published>2009-12-18T21:07:00.000-05:00</published><updated>2009-12-18T21:07:49.191-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ClickOnce'/><category scheme='http://www.blogger.com/atom/ns#' term='VSTO'/><category scheme='http://www.blogger.com/atom/ns#' term='Reg-Free COM'/><title type='text'>Reg-Free COM in VSTO Applications</title><content type='html'>So today I learned from Microsoft Support that Reg-Free COM is not supported in VSTO applications. The reason apparently is that the COM entries need to be linked to the main application manifest. In the case of VSTO applications, these are EXCEL.EXE, WINWORD.EXE, etc. I am asking them if we can work around this by loading the manifest manually via the Activation Context API. I will update when I find out more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-4095530233234053168?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/4095530233234053168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2009/12/reg-free-com-in-vsto-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/4095530233234053168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/4095530233234053168'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2009/12/reg-free-com-in-vsto-applications.html' title='Reg-Free COM in VSTO Applications'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7582189321845048092.post-5195663450358715609</id><published>2009-11-08T08:01:00.001-05:00</published><updated>2010-02-28T10:18:58.755-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='API'/><title type='text'>SharePodLib</title><content type='html'>&lt;a href="http://www.getsharepod.com/"&gt;SharePod &lt;/a&gt;is a free, lightweight application to manage music on your iPod, as well as copy from your iPod to your computer. It doesn't need to be installed and can be run directly from the iPod hard drive. &lt;a href="http://www.getsharepod.com/fordevelopers/"&gt;SharePodLib &lt;/a&gt;is the underlaying .NET library, available for non-commercial use by anyone. It's pretty cool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7582189321845048092-5195663450358715609?l=stackpush.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stackpush.blogspot.com/feeds/5195663450358715609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://stackpush.blogspot.com/2009/11/sharepodlib.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/5195663450358715609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7582189321845048092/posts/default/5195663450358715609'/><link rel='alternate' type='text/html' href='http://stackpush.blogspot.com/2009/11/sharepodlib.html' title='SharePodLib'/><author><name>Gary</name><uri>http://www.blogger.com/profile/05857387940682180537</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
