Viewbox scaling

Topics: Developer Forum
Jun 21, 2014 at 9:17 AM
Edited Jun 21, 2014 at 9:18 AM
Hi there,
  • I have a small farseer physics setup that works great as a user control but I'd ideally like to put it into a viewbox so that i can scale it. Unfortunately my static objects move and resize independent of the user control,
    <Grid Background="Transparent" Width="516" Height="516">
        <Ellipse Margin="0,0,0,0" Width="400" Height="400" Fill="White" />
        <Canvas Background="Transparent" Width="516" Height="516">
            <Path x:Name="Top" StrokeThickness="0" Data="M0.5,0.5 L499.5,0.5 L499.5,250.5 L449.494,250.5 L449.5,250 C449.5,139.819 360.181,50.5 250,50.5 C139.819,50.5 50.5,139.819 50.5,250 L50.5063,250.5 L0.5,250.5 z" Fill="Red" HorizontalAlignment="Left" Height="251" Margin="0,0,0,0" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" VerticalAlignment="Top" Width="500" Canvas.Left="8" Canvas.Top="8"/>
            <Path x:Name="Bottom" StrokeThickness="0" Data="M0.5,0.5 L50.5063,0.5 L50.5,1 C50.5,111.181 139.819,200.5 250,200.5 C360.181,200.5 449.5,111.181 449.5,1 L449.494,0.5 L499.5,0.5 L499.5,250.5 L0.5,250.5 z" Fill="Red" HorizontalAlignment="Left" Height="251" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" VerticalAlignment="Top" Width="500" Canvas.Left="8" Canvas.Top="258"/>

            <Ellipse x:Name="ball" Width="150" Height="150" Fill="Black" Canvas.Left="183" Canvas.Top="183"></Ellipse>

            <Spritehand_FarseerHelper:PhysicsController MousePickEnabled="True" GravityVertical="500" />
            <Spritehand_FarseerHelper:PhysicsStaticHolder Body="Top"  />
            <Spritehand_FarseerHelper:PhysicsStaticHolder Body="Bottom" />
        </Canvas>
    </Grid>
unscaled

Image

scaled to half ~ its size

Image

I should also point out that the red static objects change at runtime, not design time. It looks fine at design time.
Jun 21, 2014 at 12:58 PM
This issue is no longer relevant to me as I'm now using the XAML physics helper which although has a different issue altogether which I'm currently investigating, it does work fine in a viewbox.