Scrolling viewer not updating in silverlight

I have an image inside the scroll viewer, and I have an image zoom control, and when scaling an event, I zoom in as shown 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 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>
+3
source share
1 answer

The problem is that the rendering conversion happens much later in the rendering process. Later measure and phase order. The scroll viewer simply does not know any visible resizing caused by the scaling transformation; it still considers that the contained element has the size specified by the properties Actual.

LayoutTransform Silverlight Toolkit. , , , Actual . ScrollViewer , .

+3

Source: https://habr.com/ru/post/1749724/


All Articles