Last Updated: 25 Oct 2017 11:47 by ADMIN
When the Background / Foreground property of the RadBarcodeQR control is set, at runtime time that property is ignored.

On loaded, change the pixel value  of the ImageSource of the code in the following manner
(in case the Foreground is set to a valid SolidColorBrush value):

public void RadBarcodeQR_Loaded(object sender, RoutedEventArgs e)
	Image image = this.ChildrenOfType<Image>().First();
	ImageSource src = image.Source;
	Color c = ((sender as RadBarcodeQR).Foreground as SolidColorBrush).Color;
	image.Source = ChangePixelValue(src, c);

public static WriteableBitmap ChangePixelValue(ImageSource src, Color c)
	BitmapSource originalSource = src as BitmapSource;
	WriteableBitmap modifiedSource = new WriteableBitmap(originalSource);

	int h = modifiedSource.PixelHeight;
	int w = modifiedSource.PixelWidth;
	int[] pixelData = new int[w * h];
	int widthInBytes = 4 * w;

	modifiedSource.CopyPixels(pixelData, widthInBytes, 0);

	int colorInt = BitConverter.ToInt32(new byte[] { c.B, c.G, c.R, 0x00 }, 0);
	for (int i = 0; i < pixelData.Length; i++)
		pixelData[i] ^= colorInt;

	modifiedSource.WritePixels(new Int32Rect(0, 0, w, h), pixelData, widthInBytes, 0);
	return modifiedSource;
Last Updated: 03 Jul 2018 16:02 by ADMIN
If you change the value of the Text property of RadBarcodeQR while its Visibility is set to Collapsed and then set it back to Visible, the barcode generates a blurry image.

To work this around you can call the OnApplyTemplate() method of RadBarcodeQR after you change its Visibility to Visible.