急!!WPF 数据绑定的问题(绑定阴影效果)
我想把这个类中的控件(UserControl控件-附加image内容)在显示到wrapPanel值钱在UserControl创建出阴影效果,数据绑定学的不是很好跪谢了!!...
我想把这个类中的控件(UserControl控件-附加image内容)在显示到wrapPanel值钱在UserControl创建出阴影效果,数据绑定学的不是很好 跪谢了!!!。
void AddImageInFolder(string folder)
{
try
{
foreach (string s in Directory.GetFiles(folder, "*JPG"))
{
UserControl userControl = new UserControl();
userControl.Padding = new Thickness(5, 5, 5, 5);
Image img = new Image();
img.Width = 100;
img.Height = 100;
img.Stretch = Stretch.Fill;
Uri uri = new Uri(s);
BitmapDecoder bd = BitmapDecoder.Create(uri, BitmapCreateOptions.DelayCreation, BitmapCacheOption.Default);
if (bd.Frames[0].Thumbnail != null)
{
img.Source = bd.Frames[0].Thumbnail;
;
}
else
{
img.Source = new BitmapImage(uri);
}
userControl.Content = img;
this.wrapPanel.Children.Add(userControl);
}
}
catch (UnauthorizedAccessException) { }
catch (IOException) { }
} 展开
void AddImageInFolder(string folder)
{
try
{
foreach (string s in Directory.GetFiles(folder, "*JPG"))
{
UserControl userControl = new UserControl();
userControl.Padding = new Thickness(5, 5, 5, 5);
Image img = new Image();
img.Width = 100;
img.Height = 100;
img.Stretch = Stretch.Fill;
Uri uri = new Uri(s);
BitmapDecoder bd = BitmapDecoder.Create(uri, BitmapCreateOptions.DelayCreation, BitmapCacheOption.Default);
if (bd.Frames[0].Thumbnail != null)
{
img.Source = bd.Frames[0].Thumbnail;
;
}
else
{
img.Source = new BitmapImage(uri);
}
userControl.Content = img;
this.wrapPanel.Children.Add(userControl);
}
}
catch (UnauthorizedAccessException) { }
catch (IOException) { }
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询