The scroll viewer is not updating in silverlight

Posted by Malcolm on Stack Overflow See other posts from Stack Overflow or by Malcolm
Published on 2010-06-12T10:09:20Z Indexed on 2010/06/12 10:12 UTC
Read the original article Hit count: 253

Filed under:
|

I have an image inside scroll viewer and i have a control for zooming the image and in zooming event i change the scale of an image ,as below :

void zoomSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            scale.ScaleX = e.NewValue;
            scale.ScaleY = e.NewValue;
          //scroll is a name of scrolviewer
            scroll.UpdateLayout();
        }

And a xaml below

<Grid x:Name="Preview" Grid.Column="1">
            <Border x:Name="OuterBorder" BorderThickness="1"  BorderBrush="#A3A3A3" >
                <Border x:Name="InnerBorder"  BorderBrush="Transparent" Margin="2" >
                    <Grid Background="White" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <ScrollViewer x:Name="scroll" HorizontalScrollBarVisibility="Auto" Grid.Column="0" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Themes:ThemeManager.StyleKey="TreeScrollViewer">
                            <Image  Source="../charge_chargeline.PNG"  >
                                <Image.RenderTransform>
                                    <CompositeTransform x:Name="**scale**" />
                                </Image.RenderTransform>
                            </Image>
                        </ScrollViewer>
                        <Border HorizontalAlignment="Center"   CornerRadius="0,0,2,2" Width="250" Height="24" VerticalAlignment="Top">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="#CDD1D4" Offset="0.0"/>
                                    <GradientStop Color="#C8CACD" Offset="1.0"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <ChargeEntry:Zoom  x:Name="zoominout" />
                        </Border>
                    </Grid>
                </Border>
            </Border>


        </Grid>

© Stack Overflow or respective owner

Related posts about c#

Related posts about Silverlight