Reputation: 227
I am dynamically changing the canvas background in my app.
The page.xaml
code is:
<Canvas x:Name="canvasBoard" Height="695" Width="1365" Grid.Row="0">
<Canvas.Background>
<ImageBrush Stretch="None" ImageSource="/Assets/board.png"/>
</Canvas.Background>
<Canvas.RenderTransform>
<ScaleTransform ScaleX="1.0"/>
</Canvas.RenderTransform>
</Canvas>
I want to change the ScaleTransfom ScaleX
value dynamically to the background selected by the page.xaml.cs
but am unable to do so. Any help is appreciated.
Upvotes: 1
Views: 3452
Reputation: 4359
If you want to change the value of ScaleX
from code which I think is what you are asking you can do that with the following code in page.xaml.cs
:
(canvasBoard.RenderTransform as ScaleTransform).ScaleX = 10;
Upvotes: 4