'Binding' type does not have a matching DependencyObjectType error

by StefanOlson 30. May 2011 06:53

This is one of those blog posts so that I can easily remember what causes this particular problem.  In the Virtual Tour Viewer, I have found on occasions with .net 4.0 that if you press the back button, to go back to a previous page you get a “'Binding' type does not have a matching DependencyObjectType” exception.

As it turns out this is because I had PresentationTraceSources in the page. e.g:

OlsImage="{Binding SmallImageFile,PresentationTraceSources.TraceLevel=High}"

If you remove the reference to PresentationTraceSources  (which allows you to debug bindings), then the problem goes away!

interestingly, this exception only occurs when using the back button – if I go directly to a page there is no problem.  Weird, eh?

Tags:

WPF | Virtual Tours

Introduction to FlowDocument for Silverlight.

by StefanOlson 8. October 2009 15:37

As mentioned in my previous post. I have developed FlowDocument viewers for Silverlight which are intended to be API compatible with the WPF FlowDocument viewers. FlowDocuments give you the ability to display rich text content and are a feature of WPF.

Unfortunately this functionality is not currently available in Silverlight. When building the Virtual Tour Viewer I needed to flow documents, because the WPF version already displayed its text using flow documents. The solution was to build my own flow document viewer for Silverlight.

Here's what it looks like in the virtual tour viewer:

image

And here's what it looks like in the sample application for it:

 image

This unfortunately was not quite as easy as it might sound. The first problem is caused by the fact that flow documents are xaml, but the Silverlight xaml parser will not read them because they contain classes that are not in the default namespace. This unfortunately means that the documents have to be read using Linq to XML , which is a lot more work.

WPF has a couple of different types of FlowDocument viewers, the FlowDocumentScrollViewer, which as you might imagine scrolls the document. Then there is a FlowDocumentPageViewer, which displays it either in pages or columns. These are then brought together into a single FlowDocumentReader class, which as you can see in the sample above provides support for zooming and changing between these modes.

The flow document viewer as it currently stands provide support for most of the basic flow document structures as you can see above in the sample. Some features, such as embedded controls are not currently demonstrated. I intend to add support for lists and hyperlinks before release.

Unfortunately as you can imagine a project like this can take up quite a bit of time. I would love to release this as open source, but I do need to do a little bit of cleanup before it can be released, which takes time I have to take off other (paying) work. If you would like to see that flow document viewer made available, please submit a 5 star vote for the Virtual Tour Viewer in the ComponentArt Silverlight coding contest. If I win this, which your votes will help, I will release the FlowDocumentViewer and the RoutedCommand support I’ve built for Silverlight onto codeplex.

Using the FlowDocumentReader

Loading a FlowDocument

here's how you load of flow document from the resources:

StreamResourceInfo r = Application.GetResourceStream(new Uri("test.flowdoc", UriKind.RelativeOrAbsolute));
StreamReader sr = new StreamReader(r.Stream);
XElement el = XElement.Load(sr);

FlowDocument fd = FlowDocument.Load(el, FlowDocumentStyles, null, null);

Displaying a FlowDocument

To display a FlowDocument you need a FlowDocument viewer of some kind and to set the Document property. This can be done by binding, or in code as shown below:

In Xaml (the control):

<Controls:FlowDocumentReader Grid.Row="1" Foreground="White" x:Name="_Viewer"/>

In code:

_Viewer.Document = fd;

I hope that this has wet your appetite for what is possible with flow documents, and hopefully I'll win the Silverlight contest and have time to release it as open source!

Please Vote for the virtual tour viewer by clicking here

Tags:

Silverlight | Virtual Tours

Virtual Tour Viewer available for Silverlight!

by StefanOlson 23. September 2009 08:22

image

ComponentArt are currently holding a competition to find the best Silverlight application. The community can vote for their favourite application and they will then be judged by some of the most respected people in the Silverlight community.  The winner gets $10,000 US!  You can see and vote for all entrants here:
http://www.componentart.com/community/competition2009/

Over the past couple of weeks I've spent a lot of time redesigning the Virtual Tour viewer I have described in previous posts.  It's not yet perfect, but it is an improvement on the previous releases. Having redesigned the WPF version, I have ported those changes across to the Silverlight version and have entered in the competition.    There is still some work to do removing a few bugs before the official judging starts on 23 October.

You can find (and vote for) my entry here:
http://www.componentart.com/community/competition2009/details.aspx?id=1109

The competition entry includes the full Versailles Virtual Tour. We are trying to see if people will be willing to donate to help improve the tours, because it will give greater access for a larger number of people.

As I've discussed in previous posts, the Silverlight version makes use of the Silverlight WPF compatibility library that I have built, which provides Silverlight versions of routed commands, flow documents and a number of other features not found in Silverlight.  The WPF version of the Silverlight compatibility library includes features such as the URI mapper and child window.

As an incentive to encourage you to vote for the virtual tour, I will release the Silverlight WPF compatibility library on codeplex, if I win the competition.  The reason for this is the competition provides a substantial financial prize for the winner, and it would give me some additional time to be able to complete the code and samples.  The more five-star votes I get, the more likely I am to win, so please go and vote!!

If you have feedback on the tour we'd love to hear from you either via e-mail or via the comments.

…Stefan

Tags:

Virtual Tours | Silverlight | WPF

Virtual Tour Viewer beta available

by StefanOlson 17. February 2009 16:57

tourwpf

I'm sorry it has taken so long, but the beta version of the virtual tour viewer for WPF is now available.  It demonstrates the splash screen that we have developed along with targeted commands, the Silverlight WPF library and the WPF panorama library we have written.  To download the tours, click here.  The available tours are all evaluation versions, the full versions can be purchased from our website www.palacevirtualtours.com

It has taken longer than expected because we have been busy working on our core product, HyperText Studio, a WYSIWYG help authoring tool. We are finishing version 5.1 which supports Windows Vista and Windows 7.

I would love to make the Silverlight version of the virtual tour viewer available, but unfortunately I have been unable to find an affordable tool to provide obfuscation functionality for Silverlight.  For the WPF product we use .net reactor (http://www.eziriz.com/) but they don't have a Silverlight compatible version yet.  I suspect one may not be too far away as there are references to version 4 of .net reactor on their website.  If anyone knows of an affordable tool for doing obfuscation for Silverlight, please let me know.  As soon as I can get an obfuscator that works I will make the Silverlight version available so people can see it for themselves.

We are continuing to work on preparing the Silverlight WPF library and targeted commands for release.  Unfortunately it is quite a big job to prepare the demo application, so I'm not sure what the timeframe will be.

The panoramas are only available in the Buckingham Palace and Windsor Castle tours (in the Grand Staircase room in both tours).  They use the panoramas that were released on the royal web site on Friday.  If an Internet connection is available, the panorama is downloaded from the Internet and made available in the tour.

The virtual tour viewer uses a slightly updated version of the splash screen code that we have previously made available.  I will be adding that update to the splash screen page in the next couple of days.

We'd love to your feedback on the virtual tour viewer, feel free to contact us via the comments on this page or via e-mail.

If there are things you see in the tour that you would like an explanation on how we implemented it, please let me know.

If you have not installed the .net framework 3.5 on your computer the installer will attempt to download the appropriate files from our website to install it on your machine.  However because InstallAware, the maker of the installation program we use do not provide 64 bit versions of the framework, it will not be able to install the framework on vista or x64 windows 7 x64, so in this case it is a substantially better idea if you're able to install the .net framework before installing the demos.  If anyone knows of an installer that does provide x64 versions of the framework installer (and better support!), please let me know.

Known issues in the WPF Virtual Tour Viewer

Because of the complexity of fixing these issues, it's very unlikely these will be fixed before the release, apart from the icon.

  • The mouse wheel doesn’t work correctly on the picture control
  • Clicking on the Search button in the description tab will display the find box, but you are not able to put the focus in the text box. This may be a .net framework bug, but I haven’t yet investigated
  • It is not possible to see either the caret or the selection in the find box on the main toolbar. Unfortunately the .net framework doesn’t allow you to customize either of these settings so I will have to write my own textbox from scratch (or hopefully this will be fixed in the .net framework 4.0)
  • The icon needs to be redesigned
  • Printing a description currently produces a blank page.

Download links

Buckingham Palace Virtual Tour (48Mb)

Windsor Castle Virtual Tour (32mb)

Versailles Virtual Tour (59mb)

…Stefan

Tags:

Virtual Tours | WPF | Silverlight

About the author

Stefan Olson is the Managing Director of Olson Software.  He has been developing software using Microsoft Technologies for nearly 20 years.

He is currently working on building the next generation Virtual Tour software in WPF and Silverlight for www.palacevirtualtours.com.