Note that there are some explanatory texts on larger screens.

plurals
  1. POHow display picture taken with the camera in the view with mvvmcross vnext?
    primarykey
    data
    text
    <p>I was able to access the camera and take a picture (with PictureChooser plugin), It store the picture in picture-library of android, I just want to display it on the screen and delete it (I don't need to store pictures) How can I do that ? (few lines of code are welcome :)) Thanks !</p> <p>ps: maybe with File plugin of mvvmcross ?</p> <p>edit: Thanks for your answer, I think the best way for me is to do a custom binding to bind a byte[] to a normal ImageView, I saw the sample for custom binding (textview and button) and I tried to make mine.</p> <pre><code>namespace Testa.Droid.Bindings { class PictureBinding : MvxBaseAndroidTargetBinding { private readonly ImageView _imageView; public PictureBinding(ImageView imageView) { _imageView = imageView; } public override MvxBindingMode DefaultMode { get { return MvxBindingMode.OneWay; } } public override Type TargetType { get { return typeof (byte[]); } } public override void SetValue(object value) { var memoryStream = new MemoryStream((byte[])valyue); Bitmap bitmap = BitmapFactory.DecodeStream(memoryStream); _imageView.SetImageBitmap(bitmap); } } } </code></pre> <p>In Setup.cs</p> <pre><code>protected override void FillTargetFactories(Cirrious.MvvmCross.Binding.Interfaces.Bindings.Target.Construction.IMvxTargetBindingFactoryRegistry registry) { base.FillTargetFactories(registry); registry.RegisterFactory(new MvxCustomBindingFactory&lt;ImageView&gt;("Picture", (imageView) =&gt; new PictureBinding(imageView))); } </code></pre> <p>In my ViewModel I have:</p> <pre><code> public byte[] ImageData { get { return _imageData; } set { _imageData = value; RaisePropertyChanged(() =&gt; ImageData); } } </code></pre> <p>And now in my view I don't know how to use this custom binding</p> <pre><code>&lt;ImageView android:id="@+id/image" android:layout_width="fill_parent" android:layout_height="wrap_content" local:MvxBind="Picture ??, Mode=TwoWay" /&gt; </code></pre> <hr> <p>mvvcross vNext|monodroid</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload