Hi!
Thanks for the suggestion!
I tried the above solution with a bool property on my pivot UI which I set as soon as the parent UI (the popup window) is closed. I have added a message box just to be sure the event fires, and indeed, when I closse the popup dialog, the ScrollingData.Home is invoked inside the pivot control, so obviously the binding between the different UIs via the bool is working. Why the Scrollingdata is not working is beyond me... my guess there is a property on the scrollinghandler or scrollingdata that I have forgot...
Here is the code for the pivotcontrol I use:
Code: Select all
<Mcml xmlns="http://schemas.microsoft.com/2006/mcml"
xmlns:cor="assembly://MSCorLib/System"
xmlns:me="Me"
xmlns:a="assembly://MediaCenterApplication4/MediaCenterApplication4"
>
<Aggregate Source="resx://MediaCenterApplication4/MediaCenterApplication4.Resources/DetailsPivotItem" />
<UI Name="DetailsPivot">
<Properties>
<Choice Name="Model" Choice="$Required"/>
<cor:Boolean Name="Closing" cor:Boolean="false" />
<a:Application Name="Application"
Application="$Required" />
</Properties>
<Locals>
<ScrollingData
Name="ScrollingData"
EndPadding="200"
EndPaddingRelativeTo="Near"/>
<ScrollingHandler Name="ScrollingHandler" HandlerStage="Bubbled" />
</Locals>
<Rules>
<!--<Default Target="[ScrollingHandler.ScrollingData]" Value="[ScrollingData]" />
<Default Target="[ScrollingData.Repeater]" Value="[ButtonRepeater]" />-->
<Binding Target="[ScrollingHandler.ScrollingData]" Source="[ScrollingData]"/>
<Binding Target="[Scroller.ScrollingData]" Source="[ScrollingData]" />
<Condition Source="[Closing]" SourceValue="true">
<Actions>
<Invoke Target ="[Application.DialogTest]" strClickedText="WORKING!!!!"></Invoke>
<Invoke Target="[ScrollingData.Home]"/>
<!-- After reset the scroller, reset the control value also, otherwise it only works first time -->
<Set Target="[Closing]" Value="false" />
</Actions>
</Condition>
<Rule ConditionLogicalOp="And">
<Conditions>
<Equality Source="[Input.DeepMouseFocus]" Value="true"/>
<Equality Source="[Input.DeepKeyFocus]" Value="false"/>
<Equality Source="[Model.Description]" Value=""/>
</Conditions>
<Actions>
<Set Target="[Model.Description]" Value="Active"/>
<!--<PlayAnimation Animation="animation://me:PivotItemFocusOn" Target="[Scroller]" />-->
</Actions>
</Rule>
<Rule ConditionLogicalOp="And">
<Conditions>
<Equality Source="[Input.DeepMouseFocus]" Value="false"/>
<Equality Source="[Input.DeepKeyFocus]" Value="true"/>
<Equality Source="[Model.Description]" Value=""/>
</Conditions>
<Actions>
<Set Target="[Model.Description]" Value="Active"/>
<!--<PlayAnimation Animation="animation://me:PivotItemFocusOn" Target="[Scroller]" />-->
</Actions>
</Rule>
<Rule ConditionLogicalOp="And">
<Conditions>
<Equality Source="[Input.DeepMouseFocus]" Value="false"/>
<Equality Source="[Input.DeepKeyFocus]" Value="false"/>
</Conditions>
<Actions>
<Set Target="[Model.Description]" Value=""/>
<!--<PlayAnimation Animation="animation://me:PivotItemFocusOff" Target="[Scroller]" />-->
</Actions>
</Rule>
</Rules>
<Content>
<Scroller Name="Scroller"
Orientation="Horizontal"
FadeSize="-30"
Navigation="ContainHorizontal"
ScrollingData="[ScrollingData]"
CenterPointPercent="0.75,0.5,0.5"
Scale="0.9,0.9,0.9"
>
<ScrollingData>
<ScrollingData />
</ScrollingData>
<Children>
<Repeater Source="[Model.Options]" Layout="HorizontalFlow" Name="ButtonRepeater">
<Animations>
<Animation Animation="animation://me:ScrollerMoveItemSmooth"/>
</Animations>
<Layout>
<FlowLayout RepeatGap="100,0" Spacing="70,0" ItemAlignment="Near"/>
</Layout>
<Content>
<me:DetailsPivotItem Label="[RepeatedItem.ToString]"
Index="[RepeatedItemIndex]"
Model="[Model]"
/>
</Content>
</Repeater>
</Children>
<Animations>
<Animation Animation="animation://me:Slide.NavRight.Show"/>
<!--<Animation Animation="animation://me:Slide.NavRight.Hide"/>-->
</Animations>
</Scroller>
</Content>
</UI>
<Animation Name="ScrollerMoveItemSmooth" Type="Move">
<Keyframes>
<PositionKeyframe Time="0.0" Value="0,0,0" RelativeTo="Current" Interpolation="EaseOut" />
<PositionKeyframe Time="0.2" Value="0,0,0" RelativeTo="Final" />
</Keyframes>
</Animation>
<Animation Name="PivotItemFocusOn" CenterPointPercent="0.5,0.5,0">
<Keyframes>
<AlphaKeyframe Time="0" Value="0.75"/>
<ScaleKeyframe Time="0" Value="1,1,1"/>
<ScaleKeyframe Time="0.2" Value="1.05,1.05,1.05"/>
<AlphaKeyframe Time="0.2" Value="1"/>
</Keyframes>
</Animation>
<Animation Name="PivotItemFocusOff" CenterPointPercent="0.5,0.5,0">
<Keyframes>
<AlphaKeyframe Time="0" Value="1"/>
<ScaleKeyframe Time="0" Value="1.05,1.05,1.05"/>
<ScaleKeyframe Time="0.2" Value="1,1,1"/>
<AlphaKeyframe Time="0.2" Value="0.75"/>
</Keyframes>
</Animation>
<Animation Name="Slide.NavRight.Show" Type="Show">
<Keyframes>
<AlphaKeyframe Time="0.0" Value="0.0" RelativeTo="Absolute" Interpolation="Log" />
<AlphaKeyframe Time="0.1" Value="0.0" />
<AlphaKeyframe Time="0.2" Value="1.0" />
<PositionKeyframe Time="0.0" Value="600,0,0" Interpolation="EaseIn,80" />
<PositionKeyframe Time="0.2" Value="0,0,0"/>
</Keyframes>
</Animation>
<Animation Name="Slide.NavRight.Hide" Type="Hide">
<Keyframes>
<AlphaKeyframe Time="0.0" Value="1.0" RelativeTo="Current" />
<AlphaKeyframe Time="0.2" Value="0.0" RelativeTo="Absolute" />
<PositionKeyframe Time="0.0" Value="0,0,0" RelativeTo="Current" Interpolation="Log" />
<PositionKeyframe Time="0.5" Value="-1000,0,0" RelativeTo="Current" />
</Keyframes>
</Animation>
</Mcml>
It is WIP code as you might see. I use the EndPadding to keep the focus in the beginning and let the items slide to mimic the WMC native UI. I doubt that is causing my problems. There must be something that makes the control "remember it's position. Could it be the Choice collection it is bound to?
Anyway, when I close the popup, the messagebox that says "WORKING!!!" is displayed, so I know the bool flag is working properly...
Any ideas? I tried reading up on th scroller control on MSDN, but couldn't quite figure out which of the MANY properties that might interfere with what I am trying to acheive...
/H