question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] `byte[]`-to-`ImageSource` Converter

See original GitHub issue

ByteArrayToImageSourceConverter

  • Proposed
  • Prototype
  • Implementation
    • iOS Support
    • Android Support
    • macOS Support
    • Windows Support
  • Unit Tests
  • Sample
  • Documentation

Summary

The ByteArrayToImageSourceConverter is a Converter that allows the user to convert an incoming value from byte[] and returns an ImageSource. This object can then be used as the Source of an Image control.

Detailed Design

Usage Syntax

XAML Usage

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="MyLittleApp.MainPage">
    <ContentPage.Resources>
         <ResourceDictionary>
             <xct:ByteArrayToImageSourceConverter x:Key="ByteArrayToImageSourceConverter" />
         </ResourceDictionary>
    </ContentPage.Resources>

    <StackLayout>

        <Image Source="{Binding MyByteArray, Converter={StaticResource ByteArrayToImageSourceConverter}}" />

    </StackLayout>
</ContentPage>

C# Usage

class MyPage : ContentPage
{
  public MyPage()
  {
    Content = new Image().Bind(Image.SourceProperty, named(ViewModel.MyByteArray), converter: new ByteArrayToImageSourceConverter());
  }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
CalvinAllencommented, Nov 22, 2021

I know we talked about the tests being completed, but I noticed there weren’t any for ConvertBack, so I wrote a few and submitted PR #197

0reactions
msftbot[bot]commented, Mar 7, 2022

Reopening Proposal.

Only Proposals moved to the Closed Project Column and Completed Project Column can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

byte-array-to-image-source-converter.md
The ByteArrayToImageSourceConverter is a converter that allows the user to convert an incoming value from a byte array and returns an ...
Read more >
ByteArrayToImageSourceConver...
The ByteArrayToImageSourceConverter is a converter that allows the user to convert an incoming value from a byte array and returns an ...
Read more >
c# - Byte array to image conversion
I want to convert a byte array to an image. This is my database code from where I get the byte array: public...
Read more >
How to convert the byte array into an image file - NI Community
Hi. Now i'm working on convert the byte array into an image file. I have to use Labview coms so cannot use graphic...
Read more >
ImageSource(Boolean, Byte[]) Constructor
Initializes a new instance of the ImageSource class with specified settings. Namespace: DevExpress.XtraPrinting.Drawing. Assembly: DevExpress.Printing.v23.1.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found