System.Windows.Controls.UserControl, here is some trick you can use it.
Senario 1:
You need display a image in your program. You can use xaml only, or you can use C# codes only. In some cases, combine xaml and Csharp is powerful. First you create a UserControl which only contain the picture, then you get a new class. In Cshap codes, you just "new" one instance.
If you create a image use codes only, you need there lines at least:
Image img = new Image();
BitmapFrame bmp = BitmapFrame.Create(new Uri(@"C:\myImage.jpg", UriKind.RelativeOrAbsolute));
img.Source = bmp;
img.Stretch = Stretch.Fill;
But, use expression blend, you can create a new user control just by several mouse click. Then in codes, just one line:
new MyImage();
2008年7月3日星期四
订阅:
博文评论 (Atom)
没有评论:
发表评论