Skip to main content
Home Forums General Silverlight New Features in Silverlight 3 RIA Services using TransitioningContentControl
1 replies. Latest Post by Mog Liang - MSFT on November 2, 2009.
(0)
Kieran C...
Member
0 points
1 Posts
10-26-2009 7:58 PM |
Hi all,
I've got a question regarding how to best apply RIA Services to my scenario. I currently have the RIA Services go and fetch some list data from a SharePoint site and then display it to users using a TransitioningContentControl. The problem is that when transitioning content, because the DomainDataSource's DataView has moved to previous/next, the existing object is no longer referenced, which means the TCC's transition does not look correct.
When the user clicks next/previous, the DataView changes to the next/previous item correctly, however the view on the existing item is not maintained for it to be transitioned out. The existing item just disappears the moment the next item is loaded. The relevant code is as follows:
<riaControls:DomainDataSource x:Name="listObjectsDataSource" ... /> <layoutToolkit:TransitioningContentControl x:Name="tccScroller" Content="{Binding Data, ElementName=listObjectsDataSource}"> ... </layoutToolkit:TransitioningContentControl>
There are buttons outside of the TCC that trigger the transition. Example code from one of them:
tccScroller.Transition = "LeftTransition"; listObjectsDataSource.DataView.MoveCurrentToPrevious(); if (listObjectsDataSource.DataView.IsCurrentBeforeFirst) listObjectsDataSource.DataView.MoveCurrentToLast(); tccScroller.DataContext = listObjectsDataSource.DataView.CurrentItem; // must explicitly call GoToState to trigger transition // because the TCC's 'Content' is not actually changing // to automatically trigger it, just the DataContext VisualStateManager.GoToState(tccScroller, tccScroller.Transition, true);
Am I doing something wrong here? Is there a simple way to have the binding keep the reference to the 'previous' item for the duration of the transition?
Cheers
Mog Lian...
All-Star
15962 points
1,552 Posts
11-02-2009 2:22 AM |
Hi,
Are you trying to display currentitem in TransitionContentControl? if so, you need set ttcScroller.Content in code instead of setting datacontext.
Thanks,