Resource Selector Issue

Feb 20, 2009 at 4:12 PM
Hi everyone,

First off, I'd like to say thank you for your work on this project.  The resource selector and command architecture have helped me bring the Model-View-ViewModel design pattern to my Silverlight applications.  Awesome job guys!  I am wondering, however, if any attention has yet been paid to the binding issue with the resource selector (http://www.codeplex.com/SLExtensions/WorkItem/View.aspx?WorkItemId=2964).  Although this issue was originally listed with a "Low" priority, it is very high on my list of things needed.
Developer
Feb 20, 2009 at 4:46 PM
Hi,
Unfortunately I did not have Work Item notifications working on my account. I am going to investigate on the subject.
Could you please provide an isolated reproduction?

Simon
Feb 20, 2009 at 8:02 PM
Edited Feb 20, 2009 at 8:03 PM
I have a stripped down demo including all source that allows you to reproduce the issue here.  In order to reproduce the error, add at least one "Workspace" by clicking the "Add" button or the "Create new workspace" link.  Then, switch between the main windows multiple times using the "Select Window" menu until the workspace (which is a PersonView or PersonViewC) no longer binds properly and you get the class name instead of the view.
Feb 20, 2009 at 8:16 PM
Also, if the solution complains about any references, it is because I cleared out the bin folders to save space.  Just remove the references and re-add them from the silverlight project folder (namely Microsoft.Windows.Controls.dll, Microsoft.Windows.Controls.Input.dll, SLExtensions.dll).
Developer
Feb 20, 2009 at 9:35 PM
Please look at the explanation on the bug entry. This is due to the way Silverlight instanciates the ResourceDictionnary items, and it's very easy to workaround
Feb 23, 2009 at 5:10 PM
I performed the work around listed and the issue still exists.  After moving my data templates that reference the resource selector into local scope inside my Grid or Canvas, the binding still has problems.  Keep in mind that when the binding first occurs, it works fine.  The problem though is when switching between main window views.  Eventually the binding fails.  You can reproduce this error using the project I listed above.  The project still has the datatemplate "WorkspaceTemplate" in UserControl.Resources so you will have to move it into local scope (only 2 occurances:  One in MainWindow.xaml and the other in MainWindowC.xaml). 

To reproduce the error, click on "Add" or "Create Workspace" to add a person workspace.  Then, on the menu, switch between the two main windows (MainWindow and MainWindowC).  After switching a few times, the binding for the person view will break as described in the issue.
Feb 24, 2009 at 8:46 PM
I have similar problem. It manfiests itself when layout gets complicated - not sure what exactly is causing the problem (symptoms are the same) besides the sheer number of controls (when I remove a bunch of them it starts working).