Created
October 29, 2014 16:15
-
-
Save geirsagberg/4f635dad675ea03a3c1c to your computer and use it in GitHub Desktop.
MvvmCross bindable BarCodeView for Android with ZXing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BarCodeView : ImageView | |
{ | |
private string _code; | |
public string Code | |
{ | |
get { return _code; } | |
set | |
{ | |
if (_code != value) | |
{ | |
GenerateNewBarcode(value); | |
} | |
_code = value; | |
} | |
} | |
public BarCodeView(Context context, IAttributeSet attrs) | |
: base(context, attrs) | |
{ | |
} | |
private void GenerateNewBarcode(string code) | |
{ | |
Bitmap bitmap = Mvx.Resolve<IBarcodeWriter>().Write(code); | |
SetImageBitmap(bitmap); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment