Select to view content in your preferred language

Rotating Control and Map Zoom in WPF

959
1
05-25-2011 12:03 PM
centuitcentuit
Emerging Contributor
Hi,

I am having an issue where after rotating a UserControl by 90 degrees and by changing it's xy axis to rotate in it's center, when I zoom the map, the UserControl will not stay in the same point.
I am using WPF .NET 4.0 and ESRI Client Beta 2.2



Here is my XAML:

<Grid x:Name="_rootElement" Background="Transparent">
        <Grid.Resources>
            <Storyboard x:Key="_rotateAnimate">
                <DoubleAnimation Storyboard.TargetName="_rootElement" Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)"
                                 From="0" To="0" Duration="00:00:03" />
            </Storyboard>
           
        </Grid.Resources>
        <Grid.RenderTransform>
            <RotateTransform x:Name="_rotateTransform" />
        </Grid.RenderTransform>
            <Image x:Name="_image" />
    </Grid>
</UserControl>


Here is the code behind:


    public void Rotate(double angle, double x, double y)
        {
            _rotateTransform.CenterX = x;
            _rotateTransform.CenterY = y;

            Storyboard story = _rootElement.Resources["_rotateAnimate"] as Storyboard;
            DoubleAnimation da = story.Children[0] as DoubleAnimation;
            da.From = _currentAngle;
            da.To = angle;
            story.Begin(this);
            _currentAngle = angle;
        }


Can anyone tell me what I am doing wrong ?

Thanks
0 Kudos
1 Reply
centuitcentuit
Emerging Contributor
Never mind, I found the solution in this thread.

http://forums.arcgis.com/threads/28787-Scaling-Text-Symbols

Thanks
0 Kudos