图片控件运行时,图片会向右下方偏移,向右偏移10相素,向下偏移50相素,xaml代码如下:
- C# code
<navigation:Page x:Class="SilverlightApplication3.ProductDetail" 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:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" d:DesignWidth="1440" d:DesignHeight="900" Title="商品信息" > <navigation:Page.Background> <ImageBrush ImageSource="/SilverlightApplication3;component/Images/UI稿.jpg" /> </navigation:Page.Background> <Grid x:Name="LayoutRoot"> <Grid.Background> <ImageBrush ImageSource="/SilverlightApplication3;component/Images/UI稿.jpg" /> </Grid.Background> <Image Height="604" HorizontalAlignment="Left" Margin="175,262,0,0" Name="MainImage" Stretch="Fill" VerticalAlignment="Top" Width="656" Source="/SilverlightApplication3;component/Images/2.jpg" MouseLeftButtonUp="MainImage_MouseLeftButtonUp" /> </Grid> </navigation:Page>
------解决方案--------------------
不知你是不是用的 VS2008 / VS2010 生成的 MainPage.xaml显示你的这个Page,在 MainPage.xaml 中有
- XML code
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
------解决方案--------------------
这个情况不多见,我使用的是VS2010测试,没有出现偏差。
是不是你本身使用了拉伸之类的操作?