想在SilverLight插入一幅图片,不拉伸或缩小图片,当图片像素超过800*600窗口就出现滚动条,但不足800*600窗口以图片则窗口按图片实际大小。自己用下面代码没实现效果,请前辈指点一下!小弟先感谢了!(xxxx.jpg动态变化的)
<UserControl x:Class="LandQualityViewerApplication.AddIns.SoilSurvey"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
<Grid x:Name="LayoutRoot" Background="White">
<Viewbox Name="viewbox1" Margin="0,0,0,0">
<Image Source="http://127.0.0.1/xxxx.jpg" />
</Viewbox>
</Grid>
</UserControl>
------解决方案--------------------------------------------------------
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderThickness="0">
<Image Source="http://127.0.0.1/xxxx.jpg" />
</ScrollViewer>