views:

5

answers:

0

I am trying to create a simple image viewer which includes a zooming slider. using Data Binding and ScaleTransform, I am trying to "zoom" the image.

Here is my xaml:

<Grid x:Name="LayoutRoot" Background="White">
    <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>

    <Canvas Grid.Row="0" Width="400" Height="300" Margin="0,0,100,100" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Image x:Name="ImageMapView" Source="Image/map.jpg" HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="None">
            <Image.RenderTransform>
                <ScaleTransform x:Name="contentScale" ScaleX="{Binding ElementName=zoomSlider, Path=Value}" ScaleY="{Binding ElementName=zoomSlider, Path=Value}" CenterX="0" CenterY="0" />
            </Image.RenderTransform>
        </Image>
    </Canvas>

    <Slider x:Name="zoomSlider" Grid.Row="1" Minimum="0" Maximum="1" Value="0.5"></Slider>
</Grid>

When I am running the code, I am encountering a strange thing: the application starts to load, but when it gets to 100% - its stuck...

alt text

Does someone can please explain to me whats wrong?? (btw - there is nothing wrong with the image source file map.jpg. The file is there, and when I replace the binding markup extension with a fixed number, the application is loaded ok)

10x everyone!