Popular art from my DeviantArt account:
I mentioned in my post about PixelSpread that a LOT of code was replaced by using the simple features of WPF. Here's how it was done. This example illustrates the concept, but with different controls.
On our blank XAML Scene file we have a Grid object and a Slider. The grid is called grdMain and the slider is ingeniusly named Slider. To make this realistically work, we need the Grid to be in some sort of container to mask the view, but that's beyond the scope of this example. The slider's VALUE will provide the zoom factor. 0 being nothing and 10 (1000%) being the highest. Here's code:
The code is pretty straight forward. We have databound the Grid.RenderTranform.ScaleTransform.ScaleX (and Y) properties to the Slider's VALUE property. You can also use RotateTransform or other transforms as well.
To find out more about the ScaleTransform object, see this link in the WinFX Documentation. For other transforms and the Transform object itself, see this link.
The documentation notes that the RenderTransform object does only TEMPORARY transforms. That is, it does not regenerate layout size, etc. But you can simply use such binding to other "tangible" objects for storage.
Remember Me