Skip navigation
CodePlex and PDFx: Property Dependency Framework for WPF, Windows Store, Silverlight, and Windows Phone

CodePlex and PDFx: Property Dependency Framework for WPF, Windows Store, Silverlight, and Windows Phone

Related: "Infer.NET: The First Ever Patent for Humanity Award in Technology"

One great benefit about a developer framework that almost has 15 years behind it is the maturity of the developer tools, tips, tricks and workarounds that are available in the constantly updated ecosystem that surrounds it. I'm speaking about the .NET Framework. It's a multi-headed monster from ASP.NET to WinForms to WPF to Silverlight and everything in between. One of the best places to find royalty-free source code to make your .NET developer life easier is CodePlex. What's great about CodePlex is that this open source code hosting website lets users collaborate on a variety of different open source software.

CodePlex is solely owned by Microsoft and went live in June 2006 and now has close to 35,000 software projects available to the public domain. Although Codeplex encompasses several different source code projects that are primarily based on the .NET Framework, the most famous and widely used project that was born inside CodePlex is the AJAX Control Toolkit that's a joint project between the community and Microsoft.

CodePlex is an open-source website where engineers and computer scientists share projects and ideas. And this is where I come in.

Interknowlogy's First Contribution to CodePlex: 3D Molecule Viewer

In 2006 I approached Jennifer Ritzinger, Senior Director of the Developer & Platform Evangelism team at Microsoft, with a high-profile software project that that has proven to save lives by helping a number of brilliant scientists make many forms of cancer into a manageable disease. The company is The Scripps Research Institute that's led by Dr. Peter Kuhn. Dr. Kuhn pioneered several different techniques at a molecular level and continues to build upon those techniques.

Our job at InterKnowlogy was toFigure 1: 3D Molecule Viewer virtualize what Dr. Kuhn and his researchers were doing by rendering the Protein Database Format (PDB) files his devices were producing in 3D to let his researchers, scientists and doctors annotate cancer molecules in 3D space. Additionally, we needed to persist all that data and research into SharePoint team sites so that Dr. Kuhn's team could manage all aspects of the project from research all the way to treatment. Sound difficult? Although the project included lots of trigonometry and calculus, it didn't matter; it was an honor to work for these brilliant people fighting the good fight.

This was during the birth of WPF that has fantastic 3D capabilities, so we naturally worked with the WPF team mostly on perf to come up with a pretty impressible 3D prototype of a cancer molecule. Once we proved we could do it, the next step was scoping the actual project and putting a team together. Jennifer Ritzinger had the brilliant idea to add a single developer from every continent to the InterKnowlogy team. Then she said, "When completed, I want you to put the source code in Codeplex." I almost fainted. First, I had to fight the internal battle of adding unknown developers to a well-seasoned InterKnowlogy team who were some pretty big guns working directly with Microsoft's engineering team. Then I had to sell my own company on why we needed to provide thousands of lines of IP; innovative WPF 3D C#, to the public domain. Well, we did it. The project got a huge amount of PR. I demoed the app next to Steve Ballmer and Dr. Peter Kuhn all over the world and on live worldwide television.

And if you want to do 3D in WPF the source code that's hosted on CodePlex is a huge leap over the learning curve. We have done quite a bit of 3D with that engine. Be careful, though. There's a lot of math in it and you might have to dust off your high school calculus book to figure it out. There are still black holes in that source code that I can't figure out; nor do I feel the need to.

Figure 2: Example Code with 3D Molecule Viewer

By the way, Jennifer Ritzinger now leads the Imagine Cup event team at Microsoft worldwide. Not a surprise.

InterKnowlogy's Latest Contribution to CodePlex: PDFx

InterKnowlogy's latest contribution to CodePlex is a property dependency framework for WPF, Silverlight, Windows Phone 7 and 8, and Windows Store. PDFx has its roots in an extremely large and complex project we did for one of the world's largest consulting companies. It hasn't been unleashed on the world yet, so I can't go into details, but the application can be likened to an Excel-like finance and tax data visualization and modeling application that's designed to run on large form factor screens with multi-touch functionality. But that description hardly does it justice. The point is there was a basic requirement in the application for the ability to model different numeric scenarios, much like when you change a single cell in Excel and because of formulas contained in other cells, every related cell changes automatically.

Masterminded by InterKnowlogy engineer Kevin Stumpf, PDFx is a lightweight library that lets you capture the inherent relationship among the properties of your classes in a declarative manner. It's common in applications to have properties whose values depend upon the values of other properties. These properties need to be reevaluated when a change occurs in the properties on which they depend. For example, if "A" depends on "B" and "C," then we need to reevaluate the value of A whenever either B or C changes. Furthermore, B and C might not even be direct properties of the same class where A exists. Instead, they might be properties of another class or even properties of the items within a collection.

The PDFx framework handles these scenarios for you automatically by establishing a simple pattern for capturing the relationships of data in applications. Consequently, PDFx removes the need for huge amounts of plumbing code that would normally be required to do this type of thing. It also helps clarify and enhance the role of the View Model within MVVM, reducing the scattering of business logic throughout value converters.

Figure 3: Algebra Hierarchy Depicting C# Class

Figure 3 shows that the algebra hierarchy represents a C# class. Green circles stand for input properties and purple circles indicate calculated properties. The arrows show the underlying math operations as well as the property dependencies.

Figure 4: SimplePropertyDependencyTo code this use case, you'd be responsible for ensuring that all directly and indirectly dependent properties get reevaluated when an input property changes. For efficiency, you'd also want to ensure that all unrelated properties don't get reevaluated.

For instance, if Property D1 changes, then it's necessary to reevaluate C1, B1, and A1. However, a change of D3 requires a reevaluation of only C2, B1, B2, and A1.

By using PDFx in this use case, you wouldn't have to manually hardcode those relationships; the PDFx library would take care of all this for you.

All you need to do is register the relationships in human readable code within the implementation of a property like this:

Figure 5: Implementing relationships for SimplePropertyDependency

PDFx uses Portable Class Library for the main assembly, then the platform specific assembly layered on top. Like many awesome software assets in CodePlex, PDFx fills a huge gap that has been unaddressed for years.


Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.