下面的示例使用滑块来控制文本块的缩放.
<Window x:Class="ZoomTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Slider Grid.Row="0" Name="_zoom" Minimum="1" Maximum="100" />
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid>
<TextBlock Text="DataGrid" Background="Red"/>
<Grid.LayoutTransform>
<ScaleTransform ScaleX="{Binding Path=Value, ElementName=_zoom}" ScaleY="{Binding Path=Value, ElementName=_zoom}" />
</Grid.LayoutTransform>
</Grid>
</ScrollViewer>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)