private async Task AssignContent() { var sourceButton = this.Element as ImageButton; var targetButton = this.Control; if (sourceButton != null && targetButton != null && sourceButton.Source != null) { var stackPanel = new StackPanel { //Background = sourceButton.BackgroundColor.ToBrush(), Orientation = (sourceButton.Orientation == ImageOrientation.ImageOnTop || sourceButton.Orientation == ImageOrientation.ImageOnBottom) ? Orientation.Vertical : Orientation.Horizontal, }; this._currentImage = await GetCurrentImage(); SetImageMargin(this._currentImage, sourceButton.Orientation); var label = new TextBlock { TextAlignment = GetTextAlignment(sourceButton.Orientation), FontSize = sourceButton.FontSize, FontFamily = new Windows.UI.Xaml.Media.FontFamily(sourceButton.FontFamily), VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, Text = sourceButton.Text }; if (sourceButton.Orientation == ImageOrientation.ImageToLeft) { targetButton.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Left; } else if (sourceButton.Orientation == ImageOrientation.ImageToRight) { targetButton.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Right; } if (sourceButton.Orientation == ImageOrientation.ImageOnTop || sourceButton.Orientation == ImageOrientation.ImageToLeft) { this._currentImage.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left; stackPanel.Children.Add(this._currentImage); stackPanel.Children.Add(label); } else if (sourceButton.Orientation == ImageOrientation.ImageCenterToLeft) { stackPanel.Children.Add(this._currentImage); stackPanel.Children.Add(label); } else { stackPanel.Children.Add(label); stackPanel.Children.Add(this._currentImage); } targetButton.Content = stackPanel; } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml")); CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource"); LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot"); OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates"); Full = (Windows.UI.Xaml.VisualState)this.FindName("Full"); Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill"); Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); ScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("ScrollViewer"); CategoryPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("CategoryPanel"); HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("HeaderTitlePanel"); ItemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("ItemGridView"); ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView"); Title = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("Title"); Image = (Windows.UI.Xaml.Controls.Image)this.FindName("Image"); DescriptionText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("DescriptionText"); BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton"); PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle"); }
/// <summary> /// Renders an image element. /// </summary> /// <param name="inlineCollection"> The list to add to. </param> /// <param name="element"> The parsed inline element to render. </param> /// <param name="context"> Persistent state. </param> private void RenderImage(InlineCollection inlineCollection, ImageInline element, RenderContext context) { var image = new Windows.UI.Xaml.Controls.Image(); var imageContainer = new InlineUIContainer() { Child = image }; // if url is not absolute we have to return as local images are not supported if (!element.Url.StartsWith("http") && !element.Url.StartsWith("ms-app")) { RenderTextRun(inlineCollection, new TextRunInline { Text = element.Text, Type = MarkdownInlineType.TextRun }, context, false); return; } image.Source = new BitmapImage(new Uri(element.Url)); image.HorizontalAlignment = HorizontalAlignment.Left; image.VerticalAlignment = VerticalAlignment.Top; image.Stretch = ImageStretch; ToolTipService.SetToolTip(image, element.Tooltip); // Try to add it to the current inlines // Could fail because some containers like Hyperlink cannot have inlined images try { inlineCollection.Add(imageContainer); } catch { // Ignore error } }
/// <summary> /// Sets a margin of 10 between the image and the text. /// </summary> /// <param name="image">The image to add a margin to.</param> /// <param name="orientation">The orientation of the image on the button.</param> private static void SetImageMargin(Image image, ImageOrientation orientation) { const int DefaultMargin = 10; var left = 0; var top = 0; var right = 0; var bottom = 0; switch (orientation) { case ImageOrientation.ImageToLeft: right = DefaultMargin; break; case ImageOrientation.ImageOnTop: bottom = DefaultMargin; break; case ImageOrientation.ImageToRight: left = DefaultMargin; break; case ImageOrientation.ImageOnBottom: top = DefaultMargin; break; } image.Margin = new Thickness(left, top, right, bottom); }
public Card(int kind, int rank) { _kind = (Kind)kind; _rank = (CardRank)rank; _image = new Image(); _image.Stretch = Stretch.Fill; }
private void UpdateContent() { if (this.Element.Image != null) { var stackPanel = new WC.StackPanel() { Orientation = WC.Orientation.Horizontal }; var img = new WC.Image() { Source = new WX.Media.Imaging.BitmapImage(new Uri("ms-appx:///" + this.Element.Image.File)), Width = 30, Height = 30, Margin = new WX.Thickness(0.0, 0.0, 20.0, 0.0), }; img.ImageOpened += ImageOpened; stackPanel.Children.Add(img); if (this.Element.Text != null) { stackPanel.Children.Add(new WC.TextBlock() { Text = this.Element.Text }); } this.Control.Content = (object)stackPanel; } else { this.Control.Content = (object)this.Element.Text; } }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _image = GetTemplateChild("Image") as Windows.UI.Xaml.Controls.Image; _waitingText = GetTemplateChild("WaitingText") as TextBlock; }
/// <summary> /// Initializes a new instance of the <see cref="ImageVideoRenderProvider"/> class. /// </summary> /// <param name="image">The Image to target.</param> /// <param name="disableContextMenu">Whether or not to disable the context menu.</param> /// <param name="scale">The scaling algorithm to use.</param> public VideoRenderProvider(Windows.UI.Xaml.Controls.Image image, bool disableContextMenu, LayoutScale scale) { Win8LayoutManager.SafeInvoke(() => { Image = image; Initialize(disableContextMenu, scale); }, true); }
/// <summary> /// Sets the canvas to show the downloaded timetable. /// </summary> /// <param name="imageSource">Image source to downloaded timetable.</param> private void ShowTimetable(ImageSource imageSource) { //convert into a element that the canvas control can handle var timetableImage = new Image {Source = imageSource}; //clear canvas from other images ImageCanvas.Children.Clear(); ImageCanvas.Children.Add(timetableImage); }
/// <summary> /// UI Thrad callback when generating fractal part is done /// Part will be converted to bitmap and added to UI /// </summary> public async Task addFractalPartToUIAsync(FractalPart part) { Windows.UI.Xaml.Controls.Image img = sp.Children[part.getPos()] as Windows.UI.Xaml.Controls.Image; WriteableBitmap w = new WriteableBitmap(part.getWidth(), part.getHeight()); using (Stream stream = w.PixelBuffer.AsStream()) { await stream.WriteAsync(part.imageArray, 0, part.imageArray.Length); } img.Source = w; }
/// <summary> /// Initializes a new instance of the <see cref="ImageVideoRenderProvider"/> class. /// </summary> /// <param name="disableContextMenu">Whether or not to disable the context menu.</param> /// <param name="scale">The scaling algorithm to use.</param> public VideoRenderProvider(bool disableContextMenu, LayoutScale scale) { Win8LayoutManager.SafeInvoke(() => { Image = new Windows.UI.Xaml.Controls.Image(); Initialize(disableContextMenu, scale); }, true); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); image = GetTemplateChild(ImagePartName) as Image; UpdateMap(); }
public async Task Display(string message, ImageSource imageSource) { var handler = GetHandler(imageSource); var windowsImageSource = await handler.LoadImageAsync(imageSource); var image = new Windows.UI.Xaml.Controls.Image() { Source = windowsImageSource }; if (image != null) { Popup popup = new Popup(); StackPanel stackPanel = new StackPanel(); stackPanel.Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Color.FromArgb(255, 244, 244, 244)); stackPanel.Width = Application.Current.MainPage.Width; var button = new Windows.UI.Xaml.Controls.Button(); button.Content = "X"; button.Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black); button.BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black); button.Click += (sender, e) => { popup.IsOpen = false; }; if (!string.IsNullOrEmpty(message)) { var label = new Windows.UI.Xaml.Controls.TextBlock() { Text = message, FontSize = 48, Padding = new Windows.UI.Xaml.Thickness(8), }; stackPanel.Children.Add(label); } stackPanel.Children.Add(image); stackPanel.Children.Add(button); popup = new Popup() { Child = stackPanel, IsOpen = true, VerticalOffset = 30 }; popup.DragLeave += (sender, e) => { ((Popup)sender).IsOpen = false; }; } else { throw new ArgumentNullException("Image is null"); } }
private void UIElement_OnTapped(object sender, TappedRoutedEventArgs e) { Windows.UI.Xaml.Controls.Image cloudImage = sender as Windows.UI.Xaml.Controls.Image; CloudImageViewModel cloudImageViewModel = cloudImage.DataContext as CloudImageViewModel; DataPackage package = new DataPackage(); package.SetBitmap(RandomAccessStreamReference.CreateFromUri(new Uri(cloudImageViewModel.ImageUrl))); Clipboard.SetContent(package); }
public object GetCustomView(string imageName, object context) { Windows.UI.Xaml.Controls.Image svgimage = new Windows.UI.Xaml.Controls.Image() { Height = 200, Width = 200 }; svgimage.Source = new SvgImageSource(new Uri("ms-appx:///Assets/" + imageName + ".svg", UriKind.Absolute)); return(svgimage); }
private void RenderEmbed(IEmbed embed, UIElementCollection blockUIElementCollection) { switch (embed.Type) { case "link": { if (!embed.Thumbnail.HasValue) { return; } var result = new Windows.UI.Xaml.Controls.Image { HorizontalAlignment = HorizontalAlignment.Left, MaxHeight = Math.Min(75, embed.Thumbnail.Value.Height.Value), Source = new BitmapImage { DecodePixelType = DecodePixelType.Logical, DecodePixelHeight = Math.Min(75, embed.Thumbnail.Value.Height.Value), UriSource = new Uri(embed.Thumbnail.Value.Url), }, }; blockUIElementCollection.Add(result); } break; case "gifv": { var result = new MediaElement { IsLooping = true, AreTransportControlsEnabled = false, Source = new Uri(embed.Video.Value.Url), MaxHeight = Math.Min(250, embed.Video.Value.Height.Value), MaxWidth = Math.Min(400, embed.Video.Value.Width.Value), HorizontalAlignment = HorizontalAlignment.Left, IsMuted = true, }; blockUIElementCollection.Add(result); } break; case "image": { var result = new Windows.UI.Xaml.Controls.Image { HorizontalAlignment = HorizontalAlignment.Left, MaxHeight = Math.Min(250, embed.Thumbnail.Value.Height.Value), MaxWidth = Math.Min(400, embed.Thumbnail.Value.Width.Value), Source = new BitmapImage { DecodePixelType = DecodePixelType.Logical, DecodePixelHeight = Math.Min(250, embed.Thumbnail.Value.Height.Value), UriSource = new Uri(embed.Url), }, }; blockUIElementCollection.Add(result); } break; default: Debug.WriteLine("Unknown Embed Type -- " + embed.Type); break; } }
public PlaybackControl(Grid grid) { PlaybackControlGrid = grid; PlayPauseButton = PlaybackControlGrid.FindName("PlayPauseButtonOnLeft") as AppBarButton; ShuffleButton = PlaybackControlGrid.FindName("ShuffleButton") as AppBarButton; AlbumArtwork = PlaybackControlGrid.FindName("PlayBackImage") as Image; TimeRemainingBlock = PlaybackControlGrid.FindName("TimeRemainingBlock") as TextBlock; TimePastBlock = PlaybackControlGrid.FindName("TimeElapsedBlock") as TextBlock; ProgressSlider = PlaybackControlGrid.FindName("ProgressSlider") as Slider; }
private UwpControl.Image CreateImage() { var image = new UwpControl.Image(); var path = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "Win10.jpg"); var uri = new Uri(path, UriKind.RelativeOrAbsolute); image.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(uri); image.Stretch = Windows.UI.Xaml.Media.Stretch.UniformToFill; return(image); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); seconds_in = (Windows.UI.Xaml.Controls.Image)this.FindName("seconds_in"); seconds_right = (Windows.UI.Xaml.Controls.Image)this.FindName("seconds_right"); }
/// <summary> /// Displays the image. /// </summary> /// <param name="image">The image.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> private void DisplayImage(ImageSource image, double width, double height) { //convert into a element that the canvas control can handle var roomImage = new Image {Source = image, Width = width, Height = height}; //clear canvas from other images ImageCanvas.Children.Clear(); ImageCanvas.Children.Add(roomImage); Canvas.SetTop(roomImage, 0); Canvas.SetLeft(roomImage, 0); }
swc.Image Image() { var image = new swc.Image { MaxWidth = 16, MaxHeight = 16, StretchDirection = swc.StretchDirection.DownOnly, Margin = new sw.Thickness(0, 2, 2, 2) }; image.DataContextChanged += (sender, e) => { var img = sender as swc.Image; img.Source = Handler.GetImageValue(img.DataContext) as swm.ImageSource; }; return(image); }
async void UpdateContent() { var text = Element.UpdateFormsText(Element.Text, Element.TextTransform); var elementImage = await Element.ImageSource.ToWindowsImageSourceAsync(); // No image, just the text if (elementImage == null) { Control.Content = new TextBlock { Text = text }; Element?.InvalidateMeasureNonVirtual(InvalidationTrigger.RendererReady); UpdateLineBreakMode(); return; } var size = elementImage.GetImageSourceSize(); var image = new WImage { Source = elementImage, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Stretch = WStretch.Uniform, Width = size.Width, Height = size.Height, }; // BitmapImage is a special case that has an event when the image is loaded // when this happens, we want to resize the button if (elementImage is BitmapImage bmp) { bmp.ImageOpened += (sender, args) => { var actualSize = bmp.GetImageSourceSize(); image.Width = actualSize.Width; image.Height = actualSize.Height; Element?.InvalidateMeasureNonVirtual(InvalidationTrigger.RendererReady); }; } // No text, just the image if (string.IsNullOrEmpty(text)) { Control.Content = image; Element?.InvalidateMeasureNonVirtual(InvalidationTrigger.RendererReady); return; } // Both image and text, so we need to build a container for them Control.Content = CreateContentContainer(Element.ContentLayout, image, text); Element?.InvalidateMeasureNonVirtual(InvalidationTrigger.RendererReady); UpdateLineBreakMode(); }
private void OnContainerElementLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { ContainerElement.Loaded -= OnContainerElementLoaded; _commandBar = typeof(PageControl).GetTypeInfo().GetDeclaredField("_commandBar").GetValue(ContainerElement) as CommandBar; var commandBarContent = ((Border)_commandBar.Content); var image = new Windows.UI.Xaml.Controls.Image(); image.Source = new BitmapImage(new Uri("ms-appx:///Assets/xamarin-logo.png")); commandBarContent.Child = image; }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); CapturedPhoto = (Windows.UI.Xaml.Controls.Image)this.FindName("CapturedPhoto"); Gallery = (Windows.UI.Xaml.Controls.ListView)this.FindName("Gallery"); MessageBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("MessageBox"); }
public Card(Image im) { string name = im.Name; name = name.Trim(); string kind = name.Substring(0, 1); Kind kindVal = (Kind)Enum.Parse(typeof(Kind), kind); string rank = name.Substring(1, name.Length - 1); CardRank rankVal = (CardRank)Enum.Parse(typeof(CardRank), rank); _kind = kindVal; _rank = rankVal; _image = new Image(); _image.Stretch = Stretch.Fill; }
public Card(Kind kind, CardRank rank, bool trump) { _trump = trump; _kind = kind; _rank = rank; _image = new Image(); _image.Stretch = Stretch.Fill; //Uri uri = new Uri("/images/c14.png", UriKind.Relative); //System.Diagnostics.Debug.WriteLine(uri); //_image.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(uri); //"images/"+_kind.ToString()+_rank.ToString()+".png", UriKind.Relative)); ; }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///login.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); error = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("error"); flickr = (Windows.UI.Xaml.Controls.Image)this.FindName("flickr"); login1 = (Windows.UI.Xaml.Controls.Button)this.FindName("login1"); username = (Windows.UI.Xaml.Controls.TextBox)this.FindName("username"); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///FbInfo.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); txbUserName = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("txbUserName"); imgProfilePic = (Windows.UI.Xaml.Controls.Image)this.FindName("imgProfilePic"); txbBio = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("txbBio"); txbLocation = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("txbLocation"); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); userid = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("userid"); image1 = (Windows.UI.Xaml.Controls.Image)this.FindName("image1"); next = (Windows.UI.Xaml.Controls.Button)this.FindName("next"); prev = (Windows.UI.Xaml.Controls.Button)this.FindName("prev"); }
private async Task FillContent(string woeid) { var weather = await YQLUtility.GetWeatherForecast(woeid); txtLocation.Text = weather.Title; txtCurrentTemp.Text = string.Format("{0} ℃ {1}", weather.Temp, weather.Text); txtDate.Text = weather.Date; imgWeather.Source = new BitmapImage(new System.Uri("ms-appx:///Assets/Weather/" + weather.Code.PadLeft(2, '0') + ".png")); pnlForecast.Children.Clear(); foreach (var forecast in weather.Forecasts) { var panel = new StackPanel { Width = 100, BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Red), BorderThickness = new Thickness(1) }; var imgForecast = new Image { Source = new BitmapImage(new System.Uri("ms-appx:///Assets/Weather/" + forecast.Code.PadLeft(2, '0') + ".png")), Width = 50, Height = 50, HorizontalAlignment = HorizontalAlignment.Center }; var txtDay = new TextBlock { Text = forecast.Day, TextAlignment = TextAlignment.Center }; var txtHigh = new TextBlock { Text = string.Format("{0}°", forecast.High), TextAlignment = TextAlignment.Center }; var txtLow = new TextBlock { Text = string.Format("{0}°", forecast.Low), TextAlignment = TextAlignment.Center }; panel.Children.Add(imgForecast); panel.Children.Add(txtDay); panel.Children.Add(txtHigh); panel.Children.Add(txtLow); pnlForecast.Children.Add(panel); } }
private static void ImageSourceChanged(DependencyObject o, DependencyPropertyChangedEventArgs args) { TileCanvas self = (TileCanvas)o; var src = self.ImageSource; if (src != null) { var image = new Image { Source = src }; image.ImageOpened += self.ImageOnImageOpened; image.ImageFailed += self.ImageOnImageFailed; //add it to the visual tree to kick off ImageOpened self.Children.Add(image); } }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); CapturedPhoto = (Windows.UI.Xaml.Controls.Image) this.FindName("CapturedPhoto"); Gallery = (Windows.UI.Xaml.Controls.ListView) this.FindName("Gallery"); MessageBox = (Windows.UI.Xaml.Controls.TextBox) this.FindName("MessageBox"); }
static StackPanel CreateContentContainer(Button.ButtonContentLayout layout, WImage image, string text) { var container = new StackPanel(); var textBlock = new TextBlock { Text = text, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; var spacing = layout.Spacing; container.HorizontalAlignment = HorizontalAlignment.Center; container.VerticalAlignment = VerticalAlignment.Center; switch (layout.Position) { case Button.ButtonContentLayout.ImagePosition.Top: container.Orientation = Orientation.Vertical; image.Margin = new WThickness(0, 0, 0, spacing); container.Children.Add(image); container.Children.Add(textBlock); break; case Button.ButtonContentLayout.ImagePosition.Bottom: container.Orientation = Orientation.Vertical; image.Margin = new WThickness(0, spacing, 0, 0); container.Children.Add(textBlock); container.Children.Add(image); break; case Button.ButtonContentLayout.ImagePosition.Right: container.Orientation = Orientation.Horizontal; image.Margin = new WThickness(spacing, 0, 0, 0); container.Children.Add(textBlock); container.Children.Add(image); break; default: // Defaults to image on the left container.Orientation = Orientation.Horizontal; image.Margin = new WThickness(0, 0, spacing, 0); container.Children.Add(image); container.Children.Add(textBlock); break; } return(container); }
private static void ImageSourceChanged( DependencyObject o, DependencyPropertyChangedEventArgs args ) { TileCanvas self = ( TileCanvas ) o; var src = self.ImageSource; if(src != null) { var image = new Image { Source = src }; image.ImageOpened += self.ImageOnImageOpened; image.ImageFailed += self.ImageOnImageFailed; } else { self.Children.Clear(); } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); image2 = (Windows.UI.Xaml.Controls.Image)this.FindName("image2"); image1 = (Windows.UI.Xaml.Controls.Image)this.FindName("image1"); image4 = (Windows.UI.Xaml.Controls.Image)this.FindName("image4"); image3 = (Windows.UI.Xaml.Controls.Image)this.FindName("image3"); ansh = (Windows.UI.Xaml.Controls.MediaElement)this.FindName("ansh"); SKIP = (Windows.UI.Xaml.Controls.Button)this.FindName("SKIP"); }
public ButtonHandler() { Control = new swc.Button(); Control.Click += (sender, e) => Callback.OnClick(Widget, EventArgs.Empty); label = new swc.TextBlock { VerticalAlignment = sw.VerticalAlignment.Center, HorizontalAlignment = sw.HorizontalAlignment.Center, Padding = new sw.Thickness(3, 0, 3, 0), Visibility = sw.Visibility.Collapsed }; swc.Grid.SetColumn(label, 1); swc.Grid.SetRow(label, 1); swcimage = new swc.Image(); SetImagePosition(); grid = new swc.Grid(); grid.ColumnDefinitions.Add(new swc.ColumnDefinition { Width = sw.GridLength.Auto }); grid.ColumnDefinitions.Add(new swc.ColumnDefinition { Width = new sw.GridLength(1, sw.GridUnitType.Star) }); grid.ColumnDefinitions.Add(new swc.ColumnDefinition { Width = sw.GridLength.Auto }); grid.RowDefinitions.Add(new swc.RowDefinition { Height = sw.GridLength.Auto }); grid.RowDefinitions.Add(new swc.RowDefinition { Height = new sw.GridLength(1, sw.GridUnitType.Star) }); grid.RowDefinitions.Add(new swc.RowDefinition { Height = sw.GridLength.Auto }); grid.Children.Add(swcimage); grid.Children.Add(label); /* * var panel = new swc.Control { IsTabStop = false }; * panel.HorizontalAlignment = sw.HorizontalAlignment.Stretch; * panel.VerticalAlignment = sw.VerticalAlignment.Stretch; * swc.Grid.SetColumn (panel, 1); * swc.Grid.SetRow (panel, 1); * grid.Children.Add (panel); * */ Control.Content = grid; }
private async void RefreshButton_Click(object sender, RoutedEventArgs e) { if (refreshImage == null) { refreshImage = FlyoutHelper.FindNameInContainer<Image>(RefreshButton, ""); refreshProgressRing = FlyoutHelper.FindNameInContainer<ProgressRing>(RefreshButton, ""); } refreshImage.Visibility = Visibility.Collapsed; refreshProgressRing.IsActive = true; await particleDevice.RefreshAsync(); refreshProgressRing.IsActive = false; refreshImage.Visibility = Visibility.Visible; }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); LayoutControl = (Grid)GetTemplateChild(nameof(LayoutControl)); ImageControl = (Windows.UI.Xaml.Controls.Image)GetTemplateChild(nameof(ImageControl)); if (UriContent != null) { OnUriContentChanged(UriContent); } else { OnStreamContentChanged(StreamContent); } OnBackgroundChanged(Background); }
private void RenderAttachment(IAttachment attach, UIElementCollection blockUIElementCollection) { if (attach.Width.HasValue && attach.Height.HasValue) { var result = new Windows.UI.Xaml.Controls.Image { HorizontalAlignment = HorizontalAlignment.Left, MaxHeight = Math.Min(300, attach.Height.Value), MaxWidth = Math.Min(400, attach.Width.Value), Source = new BitmapImage { DecodePixelType = DecodePixelType.Logical, DecodePixelHeight = Math.Min(300, attach.Height.Value), UriSource = new Uri(attach.Url), }, }; blockUIElementCollection.Add(result); } }
//renvoie les images postées par l'utilisateur /** * Return pictures posted from the user */ public async Task <ImageContainer> createImageContainerFromPosts() { ImageContainer imageContainer = new ImageContainer(); var client_fav = new ImgurClient(client_id, imgur_token); var endpoint = new AccountEndpoint(client_fav); var favourites = await endpoint.GetImagesAsync(); for (int i = 0; i < favourites.Count(); i++) { Imgur.API.Models.Impl.Image galleryImage = (Imgur.API.Models.Impl.Image)(favourites.ElementAt(i)); Windows.UI.Xaml.Controls.Image imgImgur = new Windows.UI.Xaml.Controls.Image(); imgImgur.Source = new BitmapImage(new Uri(galleryImage.Link, UriKind.Absolute)); imgImgur.Name = galleryImage.Id; imageContainer.AddImageSource(imgImgur); } return(imageContainer); }
public void UpdateIcon(Pin pin) { if (pin.Icon == null || pin.Icon.Type == BitmapDescriptorType.Default) { var template = Windows.UI.Xaml.Application.Current.Resources["PushPinTemplate"] as Windows.UI.Xaml.DataTemplate; var content = template.LoadContent(); var path = content as Path; if (path != null) { if (pin.Icon != null && pin.Icon.Color != Color.Black) { var converter = new ColorConverter(); var colour = path.Fill = (SolidColorBrush)converter.Convert(pin.Icon.Color, null, null, null);; } if (Icon != null) { Root.Children.Remove(Icon); } Icon = path; Root.Children.Add(Icon); } } else { if (pin.Icon.Type != BitmapDescriptorType.View) { var image = new Windows.UI.Xaml.Controls.Image() { Source = pin.Icon.ToBitmapDescriptor(), Width = 50, }; if (Icon != null) { Root.Children.Remove(Icon); } Icon = image; Root.Children.Add(Icon); } else { TransformXamarinViewToUWPBitmap(pin, this); } } }
public ButtonToolItemHandler() { Control = new swc.Button(); swcImage = new swc.Image { MaxHeight = 16, MaxWidth = 16 }; label = new swc.TextBlock(); var panel = new swc.StackPanel { Orientation = swc.Orientation.Horizontal }; panel.Children.Add(swcImage); panel.Children.Add(label); Control.Content = panel; Control.Click += delegate { Widget.OnClick(EventArgs.Empty); }; }
//poste une image depuis la bibliothèque d'images /** * Post a picture */ public async void postImage(string filename) { var client_post = new ImgurClient(client_id, imgur_token); var endpoint_post = new ImageEndpoint(client_post); IImage image = null; await Task.Run(() => { Task.Yield(); using (var fs = new FileStream(@"C:\Users\Léo\Pictures\" + filename, FileMode.Open)) { image = endpoint_post.UploadImageStreamAsync(fs).Result; } }); Windows.UI.Xaml.Controls.Image imgImgur2 = new Windows.UI.Xaml.Controls.Image(); imgImgur2.Source = new BitmapImage(new Uri(image.Link, UriKind.Absolute)); imgImgur2.Name = image.Id; }
public ButtonHandler() { Control = new swc.Button(); Control.Click += (sender, e) => Callback.OnClick(Widget, EventArgs.Empty); label = new WpfLabel { VerticalAlignment = sw.VerticalAlignment.Center, HorizontalAlignment = sw.HorizontalAlignment.Center, Padding = new sw.Thickness(3, 0, 3, 0), Visibility = sw.Visibility.Collapsed }; swc.Grid.SetColumn(label, 1); swc.Grid.SetRow(label, 1); #if WINRT swcimage = new EtoImage(); #else swcimage = new EtoImage { Handler = this }; #endif var grid = new swc.Grid(); grid.ColumnDefinitions.Add(new swc.ColumnDefinition { Width = sw.GridLength.Auto }); grid.ColumnDefinitions.Add(new swc.ColumnDefinition { Width = new sw.GridLength(1, sw.GridUnitType.Star) }); grid.ColumnDefinitions.Add(new swc.ColumnDefinition { Width = sw.GridLength.Auto }); grid.RowDefinitions.Add(new swc.RowDefinition { Height = sw.GridLength.Auto }); grid.RowDefinitions.Add(new swc.RowDefinition { Height = new sw.GridLength(1, sw.GridUnitType.Star) }); grid.RowDefinitions.Add(new swc.RowDefinition { Height = sw.GridLength.Auto }); grid.Children.Add(swcimage); grid.Children.Add(label); Control.Content = grid; }
private const string BadgeValueOverflow = "*"; // text to display if the number is greater than 99 /// <summary> /// Adds badge with text on app bar button /// </summary> /// <param name="appBarButton">App bar button to add badge</param> /// <param name="item">Toolbar item</param> /// <param name="value">Value to display</param> /// <param name="backgroundColor">bBackground of badge</param> /// <param name="textColor">Foreground text color of value</param> public static void AddBadge(this AppBarButton appBarButton, ToolbarItem item, string value, Color backgroundColor, Color textColor) { if (item.IconImageSource == null) { return; // if icon is not specified in toolbar item return } var img = new Xamarin.Forms.Image { Source = item.IconImageSource }; // create new image with image source specified in toolbar item var imagePlatform = Platform.CreateRenderer(img) as ImageRenderer; // get platform renderer for image var grid = new Grid(); // create new UWP grid var image = new Image { Source = imagePlatform?.Control.Source, Stretch = Stretch.Fill, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; // create new UWP Image, and set the source to toolbar item's image source Grid.SetColumn(image, 0); // get row for image control in grid Grid.SetRow(image, 0); // get column for image control in grid grid.Children.Add(image); // add image to grid if (!string.IsNullOrWhiteSpace(value) && value != "0") // check if value is set and value not equal to 0 { var border = new Border // create new UWP border { Margin = new Windows.UI.Xaml.Thickness(10, 0, 0, 10), // add margins Background = new SolidColorBrush(backgroundColor.ToWindowsColor()), // set background color CornerRadius = new Windows.UI.Xaml.CornerRadius(13), // make border as circle Child = new TextBlock // create a UWP TextBlock { Text = value.Length > 2 ? BadgeValueOverflow : value, // set text, if value length is greater than 2, replace value with * HorizontalAlignment = HorizontalAlignment.Center, // align control center horizontally VerticalAlignment = VerticalAlignment.Center, // align control center Vertically HorizontalTextAlignment = Windows.UI.Xaml.TextAlignment.Center, // text alignment to center Foreground = new SolidColorBrush(textColor.ToWindowsColor()) // set fore color } }; Grid.SetColumn(border, 0); // get row for border control in grid Grid.SetRow(border, 0); // get column for border control in grid grid.Children.Add(border); // add image to grid } appBarButton.Content = grid; // replace UWP toolbar item content with newly created grid }
public static swc.Image ToWpfImage(this Image image, int?size = null) { var source = image.ToWpf(size); if (source == null) { return(null); } var swcImage = new swc.Image { Source = source }; if (size != null) { swcImage.MaxWidth = size.Value; swcImage.MaxHeight = size.Value; } return(swcImage); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Auto Viewer.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (Metro_Media_Streamer.Common.LayoutAwarePage)this.FindName("pageRoot"); image11 = (Windows.UI.Xaml.Controls.Image)this.FindName("image11"); image22 = (Windows.UI.Xaml.Controls.Image)this.FindName("image22"); b11 = (Windows.UI.Xaml.Controls.Button)this.FindName("b11"); b22 = (Windows.UI.Xaml.Controls.Button)this.FindName("b22"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates"); FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); }
public CellMapDisplay(Image image, uint numberCellsAcross, uint numberCellsDown, int cellSize) { bitmap = new WriteableBitmap((int)numberCellsAcross * cellSize, (int)numberCellsDown * cellSize); image.Source = bitmap; this.numberCellsAcross = numberCellsAcross; this.numberCellsDown = numberCellsDown; this.cellSize = cellSize; bytesPerCellLine = (int)numberCellsAcross * cellSize * cellSize * 4; cells = new byte[bytesPerCellLine * numberCellsDown]; for (int x = 0; x < cells.Length; x += 4) { cells[x] = 0; cells[x + 1] = 0; cells[x + 2] = 0; cells[x + 3] = 0xff; } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Principal.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); tbAhorcado = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbAhorcado"); imgAhorcado = (Windows.UI.Xaml.Controls.Image)this.FindName("imgAhorcado"); tbPalabra = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbPalabra"); txtLetra = (Windows.UI.Xaml.Controls.TextBox)this.FindName("txtLetra"); tbPuntos = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbPuntos"); barra = (Windows.UI.Xaml.Controls.AppBar)this.FindName("barra"); tbUsadas = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbUsadas"); btnResolver = (Windows.UI.Xaml.Controls.Button)this.FindName("btnResolver"); popupfin = (Windows.UI.Xaml.Controls.Primitives.Popup)this.FindName("popupfin"); popupsexo = (Windows.UI.Xaml.Controls.Primitives.Popup)this.FindName("popupsexo"); tbMensaje = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbMensaje"); menubar = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("menubar"); btnJ1 = (Windows.UI.Xaml.Controls.Button)this.FindName("btnJ1"); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Trends.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot"); gridScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("gridScrollViewer"); snappedScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("snappedScrollViewer"); gridLayoutPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("gridLayoutPanel"); itemsGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("itemsGridView"); GNameTb = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("GNameTb"); GImage = (Windows.UI.Xaml.Controls.Image)this.FindName("GImage"); GDesc = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("GDesc"); backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle"); FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///BlankPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); LoginGridAppear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("LoginGridAppear"); LoginGridDisappear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("LoginGridDisappear"); InfoAppear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("InfoAppear"); InfoDisappear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("InfoDisappear"); MainPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("MainPanel"); LoginGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("LoginGrid"); InfoGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("InfoGrid"); TitleInfoTbx = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("TitleInfoTbx"); SubtitleInfoTbx = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("SubtitleInfoTbx"); SummaryInfoTbx = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("SummaryInfoTbx"); LoginProgbar = (Windows.UI.Xaml.Controls.ProgressBar)this.FindName("LoginProgbar"); UsernameTBx = (Windows.UI.Xaml.Controls.TextBox)this.FindName("UsernameTBx"); PwBx = (Windows.UI.Xaml.Controls.PasswordBox)this.FindName("PwBx"); LoginBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("LoginBtn"); SignUpBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("SignUpBtn"); AlbumArtHolder = (Windows.UI.Xaml.Controls.Image)this.FindName("AlbumArtHolder"); SongTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("SongTitle"); Artist = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("Artist"); LoveBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("LoveBtn"); BanBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("BanBtn"); Collection = (Windows.UI.Xaml.Controls.Button)this.FindName("Collection"); RecoArtistsButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RecoArtistsButton"); RecoTracksButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RecoTracksButton"); TrendsButton = (Windows.UI.Xaml.Controls.Button)this.FindName("TrendsButton"); TweetButton = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetButton"); MapButton = (Windows.UI.Xaml.Controls.Button)this.FindName("MapButton"); MuConnectButton = (Windows.UI.Xaml.Controls.Button)this.FindName("MuConnectButton"); InfoBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("InfoBtn"); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _normalStateImage = GetTemplateChild(NormalStateImageName) as Image; _hoverStateImage = GetTemplateChild(HoverStateImageName) as Image; _hoverStateRecycledCheckedStateImage = GetTemplateChild(HoverStateRecycledNormalStateImageName) as Image; _hoverStateRecycledCheckedPressedStateImage = GetTemplateChild(HoverStateRecycledPressedStateImageName) as Image; _pressedStateImage = GetTemplateChild(PressedStateImageName) as Image; _disabledStateImage = GetTemplateChild(DisabledStateImageName) as Image; _checkedStateImage = GetTemplateChild(CheckedStateImageName) as Image; _checkedHoverStateImage = GetTemplateChild(CheckedHoverStateImageName) as Image; _checkedHoverStateRecycledCheckedStateImage = GetTemplateChild(CheckedHoverStateRecycledCheckedStateImageName) as Image; _checkedHoverStateRecycledCheckedPressedStateImage = GetTemplateChild(CheckedHoverStateRecycledCheckedPressedStateImageName) as Image; _checkedPressedStateImage = GetTemplateChild(CheckedPressedStateImageName) as Image; _checkedDisabledStateImage = GetTemplateChild(CheckedDisabledStateImageName) as Image; UpdateNormalStateImage(); UpdateHoverStateImage(); UpdateRecycledHoverStateImages(); UpdatePressedStateImage(); UpdateDisabledStateImage(); UpdateCheckedStateImage(); UpdateCheckedHoverStateImage(); UpdateRecycledCheckedHoverStateImages(); UpdateCheckedPressedStateImage(); UpdateCheckedDisabledStateImage(); }
private void PrepareImages() { _rows.Clear(); _items.Clear(); _layoutRoot.Children.Clear(); if (Source == null) return; foreach (var bitmapImage in Source) { var image = new Image(); image.Stretch = Stretch.UniformToFill; image.Source = bitmapImage; var item = new MosaicItem1(image, new Size(bitmapImage.PixelWidth, bitmapImage.PixelHeight)); _items.Add(item); _layoutRoot.Children.Add(image); } }
private async Task AssignContent() { var sourceButton = this.Element as ImageButton; var targetButton = this.Control; if (sourceButton != null && targetButton != null && sourceButton.Source != null) { var stackPanel = new StackPanel { //Background = sourceButton.BackgroundColor.ToBrush(), Orientation = (sourceButton.Orientation == ImageOrientation.ImageOnTop || sourceButton.Orientation == ImageOrientation.ImageOnBottom) ? Orientation.Vertical : Orientation.Horizontal, }; this._currentImage = await GetCurrentImage(); SetImageMargin(this._currentImage, sourceButton.Orientation); var label = new TextBlock { TextAlignment = GetTextAlignment(sourceButton.Orientation), FontSize = 16, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, Text = sourceButton.Text }; if (sourceButton.Orientation == ImageOrientation.ImageToLeft) { targetButton.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Left; } else if (sourceButton.Orientation == ImageOrientation.ImageToRight) { targetButton.HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Right; } if (sourceButton.Orientation == ImageOrientation.ImageOnTop || sourceButton.Orientation == ImageOrientation.ImageToLeft) { this._currentImage.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left; stackPanel.Children.Add(this._currentImage); stackPanel.Children.Add(label); } else { stackPanel.Children.Add(label); stackPanel.Children.Add(this._currentImage); } targetButton.Content = stackPanel; } }
private async void check_Loaded(object sender, RoutedEventArgs e) { check = (Windows.UI.Xaml.Controls.Image)sender; try { if (listing.Shop.payment_template == null) await listing.Shop.getPaymentTemplate(); // Get payment method options PaymentTemplate template = listing.Shop.payment_template; if (template.allow_check) // check { check.Height = 20; check.Width = 73; } } catch (Exception ex) { } return; }
public static swc.Image ToWpfImage(this Image image, int? size = null) { var source = image.ToWpf(size); if (source == null) return null; var swcImage = new swc.Image { Source = source }; if (size != null) { swcImage.MaxWidth = size.Value; swcImage.MaxHeight = size.Value; } return swcImage; }
/// <summary> /// Draws the specified portion of the specified <see cref="OxyImage" /> at the specified location and with the specified size. /// </summary> /// <param name="source">The source.</param> /// <param name="srcX">The x-coordinate of the upper-left corner of the portion of the source image to draw.</param> /// <param name="srcY">The y-coordinate of the upper-left corner of the portion of the source image to draw.</param> /// <param name="srcWidth">Width of the portion of the source image to draw.</param> /// <param name="srcHeight">Height of the portion of the source image to draw.</param> /// <param name="destX">The x-coordinate of the upper-left corner of drawn image.</param> /// <param name="destY">The y-coordinate of the upper-left corner of drawn image.</param> /// <param name="destWidth">The width of the drawn image.</param> /// <param name="destHeight">The height of the drawn image.</param> /// <param name="opacity">The opacity.</param> /// <param name="interpolate">interpolate if set to <c>true</c>.</param> public void DrawImage( OxyImage source, double srcX, double srcY, double srcWidth, double srcHeight, double destX, double destY, double destWidth, double destHeight, double opacity, bool interpolate) { if (destWidth <= 0 || destHeight <= 0 || srcWidth <= 0 || srcHeight <= 0) { return; } var image = new Image(); var bmp = this.GetImageSource(source); if (srcX.Equals(0) && srcY.Equals(0) && srcWidth.Equals(bmp.PixelWidth) && srcHeight.Equals(bmp.PixelHeight)) { // do not crop } else { // TODO: cropped image not available in Silverlight?? // bmp = new CroppedBitmap(bmp, new Int32Rect((int)srcX, (int)srcY, (int)srcWidth, (int)srcHeight)); return; } image.Opacity = opacity; image.Width = destWidth; image.Height = destHeight; image.Stretch = Stretch.Fill; // TODO: not available in Silverlight?? // RenderOptions.SetBitmapScalingMode(image, interpolate ? BitmapScalingMode.HighQuality : BitmapScalingMode.NearestNeighbor); // Canvas.SetLeft(image, x); // Canvas.SetTop(image, y); image.RenderTransform = new TranslateTransform { X = destX, Y = destY }; image.Source = bmp; this.ApplyTooltip(image); this.Add(image, destX, destY); }