public MainWindow()
{
InitializeComponent();//初始化
Image image = new Image();//新建图片对象
image.Source = new BitmapImage(new Uri("G:\\个人成长\\认知\\互联网\\.NET\\常用UI资源\\背景图片\\1.jpg"));//读取图片
ImageBrush ib = new ImageBrush();//新建图片对象
ib.ImageSource = image.Source;//赋值为背景图片
canvasLogin.Background = ib;//将图片对象赋值给Canvas的Background
}