So I took all my .NET 4.0 exams:

70-515 TS: Microsoft .NET Framework 4, Web Applications Development

70-519 Pro: Designing and Developing Web Applications Using Microsoft .NET Framework 4.0

70-518 Pro: Designing and Developing Windows Applications Using Microsoft .NET Framework 4.0

70-516 TS: Microsoft .NET Framework 4, Accessing Data with ADO.NET

70-513 TS: Microsoft .NET Framework 4, Windows Communication Foundation Development

70-511 TS: Microsoft .NET Framework 4, Windows Applications Development

This added the following certifications to my transcript:

http://alphafn.com/oldpics/MCPD(rgb)_1371_1372

http://alphafn.com/oldpics/MCTS(rgb)_1269_1374_1369_1373_514

So when I signed up for my week of testing to take all the .NET 4 Beta exams the 70-515 was booked solid.  Apparently you web dudes out there ate it up.  So I had to wait for it to go to production in order to take it.  Shelled out my $125 and passed it.

That makes 6 for 6 and a full house of .NET 4 Certs. 

MCPD: Web 4

MCPD: Windows 4

(If they bring back Enterprise)

MCPD: Enterprise 4

So I needed to create a hover button.  The idea is that when the mouse rolls over the button the image will flip between a normal and ‘over’ version of the button image.  This is the same thing as old school image rollover code we have all used before.  There is an image that you use for a button in the ‘normal’ or ‘off’ state and when the mouse rolls over the image the picture changes to the ‘over’ or ‘on’ state.

It is pretty easy to do this statically.  Edit the button style, slap a couple of images in the ControlTemplate and tie that to the Normal and MouseOver visual states and you are done.

But what if you want to be able to use that same style for all your buttons and you want to be able to databind the Normal and MouseOver images?

This was pretty easy with a trick here or there.

First, we need to create a HoverButton class that inherits from the standard Button.  We need to do this because we need 2 new properties for our Normal and Over image url’s.

This is the button you will place on your design surface instead of the regular button.  This one gives us NormalImageUrl and the MouseOverImageUrl.  These properties we will set to the URL for the images we want to use for our normal state and mouse over state.

Next is the Style (see the zip file at the bottom of this post for the actual code).  Since the Style is so big, I will describe the important pieces to you.

First, your XAML that contains this style code needs to have a namespace reference to the HoverButton’s namespace.  I named mine local so you will see my TargetType set to local:HoverButton.

So the style starts out like this:

Note the TargetType in both instances is pointed to the local namespace and the HoverButton class name.  The real magic occurs in the ControlTemplate portion of the code.  Here there are several Visual States defined.  We are concered with two of them (feel free to extend this to the others also): Normal and MouseOver.

You will notice in each of the two Visual States we are concerned with there is a storyboard.  The StroryBoard executes when the visual state is entered.  So for example, when the button starts out it is in the Normal state.  When the control is rendered the Normal visual state causes the storyboard defined here to execute:

 

What happens here is that the StoryBoard sets the OverImage’s Visibility property to Collapsed and the NormalImage’s Visibility property to Visible. 

Before confusion sets in, scroll down to the bottom of the style.  You will see the two images we just discussed.

The two images defined inside the button’s visual surface are the actual images you will see at runtime.  Notice that we had to set the DataContext of the Image control to the property NormalImageUrl and MouseOverImageUrl and THEN set the Source property to {Binding}.  You need this little trick in order to allow databinding to convert the string based URL to an ImageSource.

So now we are good to go.  We can use our HoverButton like this:

So now you can specify the Normal and MouseOver images for your button.  The same style can be used for all these hover buttons, just specify the 2 images and you are set. 

 

Download File – HoverButtonSource

 

 

 

 

 

 

Many thanks to Einar Ingebrigsten!  I needed to serialize and deserialize some configuration data in one of my Silverlight projects I am currently working on.  This really came in handy:

http://www.ingebrigtsen.info/post/2008/11/29/Serialization-in-Silverlight.aspx

The executive summary is that you can use the DataContractSerializer without the need for DataContract or DataMember attributes.  Einar even gives you some sweet helper methods for Silverlight to make your life even easier.

I was using Blend 4 to do some simple animations then copy and pasting the storyboard for use on other objects in my application.  When I executed the Begin() method on the storyboard I would get the following:

Cannot resolve TargetProperty (UIElement.RenderTransform).(CompositeTransform.TranslateY) on specified object.

My XAML was pretty basic.  I finally noticed that Blend had populated the RenderTransform property for me on the working objects.  When I cut and pasted and updated the target object I failed to add the render transform.  Doing so fixes the problem:

Working:

Not working:

So if you get this message it is basically telling you that you are missing the RenderTransform property on the target object.

This error can occur for many different controls (almost any XAML element); DataGrid, Grid, Canvas, Border, Frame, Button.  This error basically means that you have invalid attributes in one of your XAML tags. 

Check the tag that the error reports.  It is likely you have an attribute in there that is not valid.  The error sucks and should report this better.  But apparently even with Visual Studio 2010 and Silverlight 4 this still occurs.

This how-to will show you a few simple steps to making a clipping path in Blend 4.  Below is a mockup of my basic canvas (this is a PNG imported into Blend).  I want to make the green area visible and I want to clip the while rectangles out of the image.  Eventually, I will place some animated elements where the white rectangles are.

http://alphafn.com/oldpics/game-mockup

The first thing you want to do is to draw rectangles where you want the image to be visible.

image 

Now that I have all of my purple rectangles drawn out I am ready to convert them to a clipping path.

Remember, the rectangles are the areas that will be visible on the clipped object.

image

Choose the direct select tool: image and select all of your rectangles.  Hold down the CTRL key and you can multi-select.  You can also select the rectangles from the Objects and Timeline window.

image

Choose Object | Path | Convert to Path from the Blend menu.  This converts all your rectangles to a path which we will in turn convert to a clipping path.

image

Next, go back to Object | Path on the menu and choose Make Compound Path.  This will make one complex path from your individual paths.

image

Now that you have one compound path select the Path object from the Objects and Timelines window.  Now you can go back to Object | Path and you have the option to Make Clipping Path.

image

Now you choose the object to clip and you will now have a clipped object (an image in my case). 

image

Here is the end result in the Blend designer:

image

And here is the nice clean XAML you generated (please note, for space constraints I truncated the path data in the Clip property):

Summary of Errors:

Exception of type ‘System.Web.HttpUnhandledException’ was thrown.

The type initializer for ” threw an exception.

The C++ module failed to load while attempting to initialize the default appdomain.

Illegal operation attempted on a registry key that has been marked for deletion.

 

The full ugly error:

System.Web.HttpUnhandledException: Exception of type ‘System.Web.HttpUnhandledException’ was thrown. —> System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: The type initializer for ” threw an exception. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.TypeInitializationException: The type initializer for ” threw an exception. —-> System.TypeInitializationException: The type initializer for ” threw an exception. —-> .ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain. —-> System.Runtime.InteropServices.COMException: Illegal operation attempted on a registry key that has been marked for deletion. (Exception from HRESULT: 0x800703FA) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at .GetDefaultDomain() at .DoCallBackInDefaultDomain(IntPtr function, Void* cookie) at .LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* ) at .LanguageSupport._Initialize(LanguageSupport* ) …). — End of inner exception stack trace — at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.fieldreceiptdetail_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Solution:

This problem was related to a cross-appdomain failure.  We are using the Microsoft Dynamics AX 2009 Business Connector in this application.  The Business Connector is a C++ application that we use to talk to AX.  From what I can gather, there are two applications using the C++ DLL at the same time.  The problem is that the DLL is mixing appdomains because of our Application Pool setup in IIS 7. 

image

So to solve the problem, I created a new Application Pool for this application.  I also set the pipeline mode to Classic.  This solved the problem for me.

So I went in and took 5 of the 6 new beta exams (the 6th one was the TS Exam for Web, that one was full and could not take it for free) and I am happy to say I passed 5 of the 5 I took.  I just need to take the Web TS and I should add Web Developer 4 and Enterprise Developer 4 to the MCPD.

Now my Microsoft Certifications look like this:

519
Pro: Designing and Developing Web Applications Using Microsoft .NET Framework 4.0
Apr 09, 2010

518
Pro: Designing and Developing Windows Applications Using Microsoft .NET Framework 4.0
Apr 08, 2010

516
TS: Microsoft .NET Framework 4, Accessing Data with ADO.NET
Apr 07, 2010

513
TS: Microsoft .NET Framework 4, Windows Communication Foundation Development
Apr 06, 2010

511
TS: Microsoft .NET Framework 4, Windows Applications Development
Apr 05, 2010

http://alphafn.com/oldpics/MCPD(rgb)_1371http://alphafn.com/oldpics/MCTS(rgb)_1269_1374_1369_1373_514

http://alphafn.com/oldpics/MCSE(rgb)

 

http://alphafn.com/oldpics/MCPI(rgb)

http://alphafn.com/oldpics/MCPSB(rgb)