本文整理汇总了C#中Windows.UI.Xaml.Media.Imaging.BitmapImage.SetProxySourceAsync方法的典型用法代码示例。如果您正苦于以下问题:C# BitmapImage.SetProxySourceAsync方法的具体用法?C# BitmapImage.SetProxySourceAsync怎么用?C# BitmapImage.SetProxySourceAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Media.Imaging.BitmapImage
的用法示例。
在下文中一共展示了BitmapImage.SetProxySourceAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
public object Convert(object value, Type targetType, object parameter, string language)
{
string uriString = (value == null) ? string.Empty : (string)value;
string converterParam = (string)parameter;
BitmapImage image = new BitmapImage();
image.DecodePixelType = DecodePixelType.Logical;
if (converterParam != null)
{
if (converterParam.StartsWith("w"))
{
image.DecodePixelWidth = Int32.Parse(converterParam.Remove(0, 1));
}
else if (converterParam.StartsWith("h"))
{
image.DecodePixelHeight = Int32.Parse(converterParam.Remove(0, 1));
}
}
string proxyScheme = "image://";
if (uriString.StartsWith(proxyScheme))
{
image.SetProxySourceAsync(uriString);
}
else
{
Uri defaultUri = new Uri("ms-appx:///Assets/DefaultArt.jpg", UriKind.Absolute);
image.UriSource = defaultUri;
}
return image;
}
示例2: Convert
public object Convert(object value, Type targetType, object parameter, string language)
{
string imagePath = (value == null) ? string.Empty : (string)value;
BitmapImage image = new BitmapImage();
string proxyScheme = "image://";
if (imagePath.StartsWith(proxyScheme))
{
image.SetProxySourceAsync(imagePath);
}
ImageBrush imageBrush = new ImageBrush();
imageBrush.Stretch = Stretch.UniformToFill;
imageBrush.Opacity = 0.6;
imageBrush.ImageSource = image;
return imageBrush;
}