locked
How to get scale factor of viewbox?

    Question

  • I have some problem: need to make animation that starts from element inside viewbox and finishes outside viewbox

    It means:

    I have page where elements are placed. There is text block on the top of it and viewbox. I place gridview into this viewbox. And one moment it should start animation from gridview item

     <Viewbox HorizontalAlignment="Left" Stretch="Uniform" VerticalAlignment="Top" x:Name="vbChallengeView" >
                        <Grid x:Name="gdChallenges">
                        <GridView  
                            Margin="92,64,68,0"
                            x:Name="GvChallenges"
                            ItemsSource="{Binding Source={StaticResource GroupedItemsViewSource}}"
                            VerticalAlignment="Top"
                            HorizontalAlignment="Left"
                            ItemTemplate="{StaticResource ChallengeTileTemplate}"
                            ItemClick="GvPack_OnItemClick"
                            IsItemClickEnabled="True"
                            IsZoomedInView="False"
                            SelectionMode="None"
                            >
                            <GridView.ItemContainerStyle>
                                <Style TargetType="GridViewItem">
                                    <Setter Property="IsTabStop" Value="False" />
                                   <Setter Property="Margin" Value="0,0,24,24" />
                                </Style>
                            </GridView.ItemContainerStyle>
                            <GridView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapGrid MaximumRowsOrColumns="5" Orientation="Horizontal" />
                                </ItemsPanelTemplate>
                            </GridView.ItemsPanel>
                        </GridView>   
                        </Grid>
                    
                    </Viewbox>

    How can I determine item size in view box and it's position relatively current window?

    Thanks for any ideas

    Saturday, February 28, 2015 12:17 PM

Answers

  • Hi Anna,

    See a similar discussion: http://stackoverflow.com/questions/10588589/calculate-viewbox-scalefactor-on-a-metro-style-app

    You may either use some third party extensions for help or compare the actual width and pre-set width.

    But why not use a ScrollViewer, it could be much more easier for you to get the scale factor and do the almost same functionalities.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 02, 2015 3:11 AM
    Moderator