Sync Framework 4.0 now supports any platform. iPhone, Android, Blackberry, etc…

Sync Framework 2.1 required clients to be based on Windows. This toolkit allows other Microsoft platforms to be used for offline clients such as Silverlight, Windows Phone 7, and Windows Mobile; in addition non-Microsoft platforms such as iPhone, Android, and Blackberry can be utilized as well as HTML.

More information can be found here.

Posted in General | Leave a comment

Word Embedded PDF AcroExch error

I few days ago a client sent me a document with a PDF embedded in it. I was unable open by double clicking on the embedded PDF icon. I searched for a solution and found the following link and it show me how to fix it. 

Posted in General | 1 Comment

Silverlight DataGrid – Add new Row

Microsoft release a service pack for Silverligth 4.0 which now allows the Silverlight DataGrid to display a new row at the bottom of the grid.

Important to me is:

Issue 2 – This update enables new Add Row functionality in the Silverlight DataGrid control.
,Issue 7 – Fixed various memory leaks including:

  • Memory leaks that occur when mouse capture is used. For example, memory leaks that occur when you use CaptureMouse() in drag-and-drop scenarios. For more information, see the following Microsoft Silverlight forums discussion.
  • Memory leaks that occur when UserControl cannot be garbage-collected because it contains inline data template. For more information, see the following Microsoft Silverlight forums discussion.

The have also fixed 5 other issues for more information goto KB2164913.

Get the bits here…

08-Sep-2010 – Update:

For the New line to work you have to implement the System.ComponentModel.ICollectionView interface.

Posted in General | Leave a comment

Mindscape – Released nHibernate Designer

Mindscape just an excellent DSL for nHibernate goto to get all the goodness.

Posted in General, Tools | Leave a comment

VS2010 crashing when switching to Design view

Microsoft released a hotfix for Visual Studio 2010 that will hopefully resolve most of the crashes

Get the hotfix from KB2201993 – VS2010 crashing when switching to Design viewhere.

Posted in General | Leave a comment

Databinding Current Item

Since I’ve started in with WPF (2007) I’ve seen many people creating Validation.ErrorTemplates with the following Binding to display the error message

{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}

When this binding is used you will see the following errors appear in the Debug Output window:

System.Windows.Data Error: 16 : Cannot get ‘Item[]’ value (type ‘ValidationError’) from ‘(Validation.Errors)’ (type ‘ReadOnlyObservableCollection`1′). BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=’AdornedElementPlaceholder’ (Name=’customAdorner’); target element is ‘TextBlock’ (Name=”); target property is ‘ToolTip’ (type ‘Object’) TargetInvocationException:’System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
at System.Collections.ObjectModel.ReadOnlyCollection`1.get_Item(Int32 index)
— End of inner exception stack trace —
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’

When you change the Binding from

{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}


{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)/ErrorContent}

All the exception related to the [0] will be a thing of the past as the / will bind to the current item of the collection and will not cause a any errors if there is no current item.

This could also be used when you have a collection of items and want to display the current item’s properties on a UI (View).

Hope this post can help other people.

Kind regards,

Johan J v Rensburg

Example Source Code: DataBinding CurrentItem.rename_to_zip

Posted in WPF | Tagged | 3 Comments

Free giveaway from Mindscape for the first 50 members

Mindscape is giving away Visual Tools for SharePoint for the first 50 users click here. Hurry up times running out.

Posted in Tools | Tagged , | Leave a comment

Agile is treating the symptoms, not the disease

Very good artical about simplicity. “Agile is treating the symptoms, not the disease”.

Posted in General | Leave a comment

Overflow or underflow in the arithmetic operation. XAML + WPF + Delphi

I came across a very strange exception. Cannot create instance of ‘ScrollViewer’ defined in assembly ‘PresentationFramework, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The type initializer for ‘System.Windows.Controls.ScrollViewer’ threw an exception. Overflow or underflow in the arithmetic operation I was not doing any calculations so I knew it was not part of my application but yet is caused one of my applications to crash as soon as its executed from another application.

Context: Im busy building a UI that must be displayed from our current C# application and from our legacy Delphi application. I created a com interface for the .Net assembly which then is used by the Delphi application as a normal com object.
The problem came when we created a test application that called the method that was exposed by the com interface. As soon as the method was executed I got the following error: ‘Maximized’ value cannot be assigned to property ‘WindowState’ of object ‘Project.SomeView’. Overflow or underflow in the arithmetic operation.

While debugging the problem I found the root cause was the Overflow or underflow in the arithmetic operation exception. This exception came from inside the Microsoft PresentationFramework assembly I did not know what to do (Ive never seen anything like this) so as any other developer would I fired up Firefox and goggled Overflow or underflow in the arithmetic operation exception

I found a post that had the code below but it was completely unrelated to WPF or Delphi.
While looking at the code I thought to myself that sure cant be the answer to the problem Im having. But decided to implement the function in any case just to see what will happen.

[DllImport( “msvcr70.dll”, CallingConvention = CallingConvention.Cdecl )]
public static extern int _fpreset();

I did some research on the API and found that it resets the floating point package. More information about the API can be found here. In my constructor just before the InitializeComponent() method I’ve added the following line

// Reset the Floating Point

So in the end my constructor looked like this:

public SomeView()

// Reset the Floating Point (When called from External Application there was an Overflow exception)

// Initialize the Component

I’ve posted a the same solution here

Hope this helps anyone in the future.


Posted in WPF | 3 Comments

Web browsers and the middel mouse button

I’ve realized in the last few months that not a lot of people are aware of the fact that you can use the middle mouse button to open a link on another tab.

So far this function is available in all tab-enabled browsers.

Just thought I should share this as I still see people not using the middle mouse button to open links. It’s such a time safer to middle click on a link and let it open in the background while you continue to browse on the current page.

Posted in General | Leave a comment