why am I getting this error? (System.Windows.Data Error: 4)

Dec 31, 2011 at 12:17 AM

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Button', AncestorLevel='1''. BindingExpression:Path=IsEnabled; DataItem=null; target element is 'GrayscaleEffect' (HashCode=1138448); target property is 'DesaturationFactor' (type 'Double')

Step to reproduce:

  1. create a new WPF 4 Catel app using .NET 4
  2. add reference to log4net
  3. install-package catel.windows
  4. build and run, check output window

BTW, I hope there is a tutorial for WPF beginners trying to use Catel.  I did check out articles available here as well as CodeProject site.

Jan 2, 2012 at 3:40 PM

I will take a look at it. Thanks for letting us know.

There are lots of example projects and articles. If that doesn't help you out enough, you might also want to check out the documentation at http://catel.catenalogic.com. If that doesn't help either, please let us know what steps confuse you so we can help you further.

Jan 6, 2012 at 1:43 PM

Thank you for letting us know. The issue is fixed and will be included in the next beta (released via nuget).

Jan 13, 2012 at 7:19 AM

thanks for fast action and fixed that issue.

I am in the beginner group, I prefer Catel because the communication happens like your quick reply and dedication to improve. Other frameworks for me is harder to get to, if I can't figure out why it failed to compile, or lacking solid tutorials.

However, I'd like to share my thought and experience when learning WPF while picking up unfamiliar framework, all from online tutorials here and there (articles on MSDN/CodeProject/Google/etc.  It is not easy!

For example, improvement can be made specific to Catel:

1 - following "Creating your first WPF project" from http://catel.catenalogic.com/, the document failed to inform user that one must get log4net installed and add reference to that.  Otherwise you will immediately hit compilation error.  Consider users who doesn't know NuGet, or having issue with NuGet all add up frustrations.

2.  the template project runs, fine.  But I hope there is a bridging chapter like Catel 101 or 102, which hand hold user to add a property or two, hook up to the view.  If not, having an alternative template that puts "Here goes your real content" in the View Model, not in the XAML should also help beginner using databinding along with Catel framework (which may be not too different comparing WPF without Catel, but beginners do not get that)

I don't doubt experienced users will not need such details.


Jan 13, 2012 at 10:44 AM

Great to hear that you haven't gave up. 


1) You should not have to add a reference to log4net. We removed the reference to log4net in 2.2 (or something like that). Maybe you should update the visual studio extension with new templates? We have written a setup package so you can also install the libraries (become available in the Add References dialog), templates and code snippets via an easy installer.

2) If I have some time left, I will create additional documentation, but you are free to create blog posts of your experience (and how you wrote your first app). We can then use that in the documentation as well.

You are right that Catel MVVM is not for beginners, it requires a basic understanding of WPF, SL or WP7 and MVVM. However, we should make that easier. Will think on how to do that.

Jan 25, 2012 at 2:29 AM

thanks for the reply as always.

frankly as a casual leaner, I have not committed myself to do anything serious yet...

Anyway, I recorded my experience installing Catel Extension Manager and Package Manager Console, here is what I commented earlier regarding log4net error. Also noticed that the first step I saw Catel 2.4, but the later step the 2.5 is installed. 


Jan 25, 2012 at 7:19 AM

Thank you for taking the time to record your experience.

1) I have no idea why the extension installer fails. The extension uses the <allUsers /> attribute, which mean the extension will be installed for all users. Therefore it requests administrator privileges. That part is out of our hands and regular behavior for VS extensions.

2) About the log4net. It looks like you are having an old version of the visual studio extension. The log4net requirement is removed, so maybe you have some templates defined in my documents as well?

What you might try is to use the installer that ships with Catel 2.5. It installs the following on your computer:

  1. Libraries (so you can add the via "add reference" if you like)
  2. Documentation (so you now have offline documentation)
  3. Code snippets (are not installed with the visual studio extension, simply not possible)
  4. Project and item templates

Then you have everything you need and we tested this setup package quite well.

Jan 26, 2012 at 6:40 AM


I uninstalled the 2.4 version and downloaded/installed 2.5 using installer.  The last screen saying it is updating the template cache.  But when I launched the VS2010, creating a new project I didn't see Catel project types under Windows.  Does this mean the template is not installed properly?

Jan 26, 2012 at 7:25 AM

When using the installer, the Catel templates are not under "Windows" but have a custom node called "Catel" on a default installation, under "Office", it's the 4th template group.

Can you verify that the templates are located here:

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Catel\1033

Jan 26, 2012 at 3:05 PM

No, it is not there.  Shall I reboot my machine after installation?  The only difference I see is 4 menu items under Start>All Programs>Catel.

 Directory of C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp

04/27/2011  09:13 PM    <DIR>          .
04/27/2011  09:13 PM    <DIR>          ..
04/27/2011  07:33 PM    <DIR>          Cloud
05/19/2011  08:44 AM    <DIR>          Office
04/27/2011  07:44 PM    <DIR>          Reporting
04/27/2011  09:13 PM    <DIR>          SharePoint
04/27/2011  07:33 PM    <DIR>          Silverlight
04/27/2011  07:39 PM    <DIR>          Test
04/27/2011  07:27 PM    <DIR>          WCF
04/27/2011  07:33 PM    <DIR>          Web
04/27/2011  07:33 PM    <DIR>          Windows
04/27/2011  07:29 PM    <DIR>          Workflow
               0 File(s)              0 bytes
              12 Dir(s)  16,468,058,112 bytes free


Jan 26, 2012 at 5:37 PM

Strange, the installation should not continue without elevation. But, it hasn't installed the setup. Very strange, you did not uncheck it in the setup?

Jan 26, 2012 at 6:07 PM
Edited Jan 27, 2012 at 12:35 AM
I used all default option,  here is a screencast for you:


On Jan 26, 2012, at 9:37 AM, "GeertvanHorrik" <notifications@codeplex.com> wrote:

From: GeertvanHorrik

Strange, the installation should not continue without elevation. But, it hasn't installed the setup. Very strange, you did not uncheck it in the setup?

Jan 28, 2012 at 3:11 AM

I have to second what's going on. Just ran the v2.5 installer. I have a "Catel 2.5" folder at the root of C:\Program Files (x86). The "snippets" and "templates" folders are both empty in that path. There's no Catel assets of any kind in any Visual Studio folders underneath "Program Files" or "Program Files (x86)".

Also, the VS Extension Manager still have v2.4. I'd really prefer not to install v2.4 only to upgrade once you fix the standalone installer. But I'll take any other advice you have in the interim on getting the v2.5 templates in place.

I'm going out to take a look at the source download now to see if I can extract the template from there.

Looking forward to taking it all for a spin!

Jan 28, 2012 at 3:56 AM

Ok. I got everything installed. swuphoto, here's the process:

  • Download the source files from here.
  • Unzip and navigate to "Catel 2.5 - source\src\Catel.VSExtension.Templates\". Notice the "I" & "P" folders.
  • Move all the zip files in "I\Catel" to "Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Catel" (you'll have to create the "Catel" folder)
  • Move all the zip files in "P\<child directories>" to "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Catel\1033" (you'll have to create the "Catel\1033" folders)
  • Pull up the Visual Studio command prompt
  • Type & run the following. It'll just sit there not looking like anything's happening for a while; let it run:
    devenv /installvstemplates
  • Open VS 2010...you should be golden.
Jan 28, 2012 at 5:55 AM

hi Boydski, many thanks for the help!  I followed your steps and now on the command prompt to install the template manually.  It does seem to be take quite long (passing 20 minutes and not ending yet, there is almost no disk activities...)

just a quick question, I did try to understand how Visual Studio template can be created and installed by looking at some Youtube videos, none of them took that long to install (demonstrations typically create and export user template right inside VS IDE, and it appears to me no time is needed to begin using new template).

Jan 28, 2012 at 7:21 AM

@swuphote: VS2010 can take a long, long time. On a fresh new machine, 8 GB of rams, 4 processors and SSD disks is takes almost 2 minutes. The completely rebuild the whole visual studio cache (unzipping all the project and item templates, etc). And in the meantime I think they are calculating pi with 300 digits...

What the others are doing is installing the templates into the "My Documents" folder. This is nice if you have your own custom templates, but not if you want them installed for all users.

@Boydski Very nice Boydski, thank you very much for finding the issue. It was a x64 issue. I will see if I can fix that. If you are new to Catel, you might as well try out the new beta (which is currently only available with NuGet). If saves you from creating all the intermediate classes. If not, 2.5 works great as well ;)

Jan 28, 2012 at 7:31 AM

I have quickly rebuild the setup package to make sure it always uses the x86 program files. Can you try this one and verify whether it works?


Jan 28, 2012 at 1:56 PM

So it was merely an issue on 64-bit systems. That'll do it to ya.  {-o)

You're very welcome sir. My pleasure. Will you be able to drop a new package out there for NuGet and Extension Manager soon?

Jan 28, 2012 at 4:40 PM
Edited Jan 28, 2012 at 7:42 PM

no, my two machines are XP and Vista 32-bit and neither are working with the older 2.5 installer.  I am trying the new one again. thanks both trying to help, will also try the beta later.

- --

ok, so following Boydski's detailed instructions and getting the latest and greatest 2.5 I still got no template installed.  The good news is that I found what works for me now after Googling "devenv options" -

change the last step to "devenv / setup".  This took less than 2 minutes on two of my PCs and I finally had the the template installed!

Jan 29, 2012 at 7:04 AM


The latest beta is available on NuGet. The templates haven't changed since 2.4, so there is actually no need to really upgrade. Maybe we will in the near future. For 3.0, the templates are definitely being upgrades (and we will remove the "logic as behavior" since that is hardly used and only makes it more complex).


Great to hear that you finally got it all installed. Now let's hope the rest of the experience goes smoother :)

Feb 4, 2012 at 10:09 PM

@GeertvanHorrik, I'm just getting started with Catel and wanted to start with the 3.0 beta. I installed NuGet and found the 2.5 packages but was unable to find the 3.0 beta. Do I have to add another package source in addition to the 'offical' source?

I've downloaded the 3.0 source but haven't tried to build it yet. Do I have to install any other packages before I can build?

Finally, I'm new to NuGet as well. It seems that I cannot use NuGet to do a 'general' installation (that is, it installs for only the open solution). Is that correct or am I missing something?


Feb 5, 2012 at 9:49 AM

Hi Casterle,

See the following documentation:

Getting the latest version via NuGet

NuGet can indeed only download references for the current solution. The idea behind this is that you don't have to put all the linked references into your version control system, but that NuGet takes care of that. Then you can also be notified of new updates and you don't have to look everywhere for new versions.

We are currently creating a new project structure where there will be more place for extensions that don't increase the size of the initial libraries. This way, it is easier only to link what you use. However, the 3.0 beta is already very nice in comparison to 2.5 :)

Feb 5, 2012 at 10:29 PM

Excellent. Thank you!


Feb 27, 2012 at 6:24 PM


I just moved to a new machine (another 64-bit box) and downloaded the latest installer v2.5. It looks like it's still not dropping the templates in. I also went through the process of dropping them in manually from src and installing, and they're still not showing up in VS 2010.


Feb 27, 2012 at 7:20 PM

Also, I found the templates on the Extension Gallery, but they're listed as v2.4. Any timeframe on when they'll be updated with what's in the downloadable source?

Feb 28, 2012 at 3:57 PM

We will update the extension for 3.0, but we are thinking of letting the extension go (since it only installs extensions, the installer also installs code snippets and the actual references).

Feb 28, 2012 at 4:05 PM

As long as the installer is fixed to place templates in the proper location, that sounds good. The current v2.5 installer says it's installing the templates, but they don't show up in the VS IDE.

I know you work hard on this *plus* whatever your regular job is where you actually make money. So I'm certainly not meaning to appear pushy. You're doing an awesome job! Thanx!

Feb 28, 2012 at 5:47 PM

Ok, so I investigated some, and I think I found some ways to support it. Can you please try this package:

Catel 3.0 beta setup package

Remember, it is Catel 3.0. It contains all the goodies of Catel 3.0. It also contains the latest (compatible) item and project templates. 

To find out more information about Catel 3.0, see this premature documentation:


Feb 28, 2012 at 6:47 PM

Ok, so the good news: Everything installed well and the templates are all there in the VS IDE as expected. Great job!

Some bad news: The assets included in the installer are still referring back to what appears to be deprecated assemblies. Per your docs above:

Assembly names have been changes so they are equal for all target frameworks

Not sure what all was modified, but there is no longer a "Catel.Windows" assembly as there was before. Yet the MainWindow.xaml is still referencing that assembly. There's a "Catel.Windows.Interactivity" assembly in the Catel library path. But it's not in the GAC as it's not showing up in the .NET tab when adding references. It also doesn't have the necessary types that were in Catel.Windows.

In lieu of hearing back from you on this, I'm going to keep experimenting to find out if the "DataWindow" type is sitting in a different assembly now. If so, I'll fix the reference in the MainWindow code. I'll report back if I find the answer before you reply here.

Feb 28, 2012 at 6:49 PM

Ok, so I immediately dug deeper into your documentation and see the mapping of the old-to-new assembly names. So far so good...

Catel.Windows (deprecated) => Catel.MVVM

Feb 28, 2012 at 7:05 PM

All is well. Back up and running. U rawk!

And again, great job!

Feb 28, 2012 at 7:27 PM