WPF

Metro Style Panorama Control For WPF

The other day as part of a bigger article I am working on I wanted a control something like the Metro (Win8/Metro) UI, but for WPF. I had a look around and there weren’t that many out there, and the ones that were out there seems to scroll in weird and unfamiliar ways. So I decided to write my own, now its not exactly the same as the Windows8 one, but it does offer these features

  • Templating ability via DataTemplates (in your own code…Bonus)
  • Its a lookless control, as such template/style it it as you see fit
  • Its easy to use
  • 2 forms of scrolling, either snapback or using friction to current mouse co-ordinates

 

Here is a screen shot of it

 

PanoramaBig

Here the full article which has the code and describes how to use it:

http://www.codeproject.com/Articles/370650/Simple-Metro-Style-Panorama-Control-For-WPF

Advertisements
C#, Lambdas / Anonomous delegates, LINQ

Expression Tree Visualizer

Some of you may remember a rather handy ExpressionTree debugger visualizer that allowed the visualization of expressions. Basically it was extremely handy and a great way of getting to know the Expression API a bit better.

Unfortunately this was a VS2008 sample, and it does not seem to come with VS2010.

I had not been missing it as I have not been doing much with Expressions, that is until the other day, and I really started to miss it. So I set about trying to get it to work.

Here are the steps you will need to follow to get it to work

  1. Downloaded VS2008 samples from link above : http://code.msdn.microsoft.com/Visual-Studio-2008-C-d295cdba
  2. Open contained Expression Debugger Visualse project in VS2010
  3. Change the projects to target .NET4.0
  4. Change the references to point to this location for the DebuggerVisualizers.dll : C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.VisualStudio.DebuggerVisualizers.dll
  5. Add a DebuggerVisualizer assembly targeting attribute definition for each and ever subclass (and including) Expression
  6. Built the projects, checked that I can actually visualize an expression tree. All works fine in modified standalone project from samples
  7. Copied the ExpressionTreeVisualizer.dll to the following locations

    …\Documents\Visual Studio 2010\Visualizers …\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\Visualizers

Just in case you are curious about what I mean in  by Step 5 above, this is what I had to do

 [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(Expression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(BinaryExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(BlockExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(ConditionalExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(ConstantExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(DebugInfoExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(DefaultExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(DynamicExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(GotoExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(IndexExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(InvocationExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(LabelExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(LambdaExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(ListInitExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(LoopExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(MemberExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(MemberInitExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(MethodCallExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(NewArrayExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(NewExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(ParameterExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(RuntimeVariablesExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(SwitchExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(TryExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(TypeBinaryExpression), Description = "Expression Tree Visualizer")] [assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),      Target = typeof(UnaryExpression), Description = "Expression Tree Visualizer")] 

Worked a treat and for those of you that are simply to lazy to do this work, here is zip file containing a valid VS2010 copy of a C# project that will build this Expression Debugger Visualizer for you:

http://dl.dropbox.com/u/2600965/ExpressionTreeVisualizer.zip

ASP MVC, CodeProject

Hosted CodeStash Is Out There

Some of you who read my articles over at http://www.codeproject.com might have seen that I have been busy working on a web based snippet tool called “CodeStash”. I recently wrote all about “CodeStash” over at http://www.codeproject.com.

 

“CodeStash” actually comes with a Visual Studio 2010 Addin, which was written by http://www.codeproject.com buddy Pete O’Hanlon, which integrates very nicely with Visual Studio.

We are now very pleased to say that a free hosted version of “CodeStash” is available

 

You can start using it at : http://www.codestash.co.uk. There is also a full PDF help document which outlines how to use  “CodeStash”.

And you can download the addin from here : http://visualstudiogallery.msdn.microsoft.com/8fd9a61e-2b3f-489b-b192-f898b2e0ee53

We will be making making changes to “CodeStash” over time to make it better. Right now the list of improvements has these things on it

  1. Allow users to view snippets without being logged in, and only require login for things that actually require linking to specific user (such as Add snippet/Edit snippet/Create team)
  2. Plugin for Eclipse
  3. Plugin for SharpDevelop
  4. Plugin for Blend
  5. Full Snippet support for VS2010 Addin
  6. Allow users to pick their own theme
  7. Make tooltips non animating

 

Anyway we hope that people start to use this free service, and if you can think of anything you think is missing, please let us know

Uncategorized

A Few Blog Issues

 

I have been experiencing a few issues with Malware on my blog. In fact it got bad enough that google put a warning page up for “sachabarber.net”.

I have now taken steps to fix this

 

  1. Moved directly to wordpress (my friends used to host my blog)
  2. Got a new Blog
  3. Redirected sachabarber.net to new wordpress blog
  4. Imported ALL images/text from old blog

It has gone quite well, and I think being on wordpress servers may be better for noticing Malware and SPAM generally. So its not all bad.

One thing that is bad however, is that some content has become sort of corrupt. Where there appears to be some CSS markup in the body of the posts. I will not be fixing this, I am sorry to say. But the relevant code it still there, so hopefully you can find the relevant parts.