Binding to FrontInView

Mar 19, 2009 at 5:20 PM
Hi, First off.. great project!, i love the ContentControl3d and am planning to use it extensivly in my app i'm working on at the moment. However i have one thing i can't figure out how to accomplish. I wan't a few of these controls to bind to a property on my viewmodel. For example. i have a property isDetailed on my viewmodel. I want the user to be able to select a detailed or a picture view for a given object (let's say a customer). Whenever a user selects the option 'detailed view' i want a couple of controls to automatically flip to the detailed side of the control. Without the user actually clicking the control. My question is how can i tie this together to my viewmodel. I was thinking of binding it to the IsFrontInView property but it's a readonly property. What is the easiest/best way to achieve this behavior ?

Thanks in any case for this great control, i'm just a hobbyist (yes they exist :D) and your articles, and in this case controls, are a great learning tool for me, keep it up !!, Jape
Coordinator
Mar 19, 2009 at 5:55 PM
Hi Jape,

Thanks for your feedback!  I'm really glad to know that my hobby assists you in yours. :)

While designing and implementing ContentControl3D, I thought long and hard about whether or not to make IsFrontInView a read-only property or not.  Since I could not think of a use case that justified having it be read-write, I kept it as read-only.  Now that you have presented me with this compelling reason, I will set aside some time to make IsFrontInView read-write. 

Thanks,
Josh
Coordinator
Mar 19, 2009 at 5:56 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Mar 20, 2009 at 2:39 AM
Hi Jape,

I just checked in some changes that enable your scenario. Due to some complexities around the semantics of the IsFrontInView property (*see below for more info), I decided to leave it as a read-only property.  Instead of making that property read-write, I added a new enumeration called RotationDestination.  You can pass a value of that enum as a parameter to the RotateCommand when executing it.  From your ViewModel object, execute the ContentControl3D.RotateCommand, and pass in a RotationDestination value as the parameter...ContentControl3D will handle the rest.

I created a new sample in the ContentControl3D_Demo project, called 'Rotation Destination.'  That sample shows how to do what I'm describing here.  You can get the latest source code via the Source Code page for this project.

Please let me know if this solution satisifies your requirements.

Thanks,
Josh

* The IsFrontInView property is set to a new value after a rotation completes.  If I were to allow that property to be set externally (i.e. via data binding), then it would be set to a new value before a rotation started.  Various pieces of logic in ContentControl3D depend on that property to be set after a rotation, and logically it makes sense (to me) that it should not have a new value until the rotation is done. 
Mar 21, 2009 at 10:24 PM
Thanks for the quick update Josh. I haven't yet had time to update my own project with it but will do so asap. I have added one more question to the work item discussion. However it will likely take me some days to reply as from tomorrow on i'll be in France at most probably the last place on earth where there still is no decent internet connection available ;(.

Jape,