本文整理匯總了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;
}