Telerik Forums
UI for WPF Forum
1 answer
27 views

Hi,

I'm trying to add a barcode inside a FlowDocumentEditor.

 


public static ImageInline InsertQRCode(this RadFlowDocumentEditor editor, string code, double width = 96)
{

    // Barcode
    const double imgWidth = 1000;
    var barcode = new RadBarcode
    {
        Width = imgWidth,
        Height = imgWidth,
        Symbology = new QRCode()
        {
            ErrorCorrectionLevel = ErrorCorrectionLevel.H,
            CodeMode = CodeMode.Alphanumeric
        },
        Value = code
    };
    
    barcode.BeginInit();
    barcode.Measure(new Size(imgWidth, imgWidth));
    barcode.Arrange(new Rect(new Size(imgWidth, imgWidth)));
    barcode.UpdateLayout();
    barcode.EndInit();

    using (var stream = new MemoryStream())
    {
        Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(barcode, stream, new PngBitmapEncoder());
        stream.Position = 0;

        return editor.InsertImageInline(new Telerik.Windows.Documents.Media.ImageSource(stream, "png"),
            new Size(96, 96));

    }

At barcode.Measure, I've got an NullException. This didn't happen with old RadBarCodeQR component.

Any ideas?

Martin Ivanov
Telerik team
 answered on 07 Nov 2023
3 answers
218 views

Hello,

we have old code for generate label with barcode Code39

var barcodeBox = new RadBarcode39
{
 Text = "2015-19541",
 RenderChecksum = false,
 ShowChecksum = false,
 ShowText = false,
 Width = 192,
 HorizontalAlignment = HorizontalAlignment.Center,
 VerticalAlignment = VerticalAlignment.Stretch,
 Margin = new Thickness(5, 0, 5, 0),
}; 

and have result https://ibb.co/3hgJHCw

after upgrade to new control with code

var barcodeBox = new RadBarcode
{
 Value = "2015-19541",
 Width = 192,
 HorizontalAlignment = HorizontalAlignment.Center,
 VerticalAlignment = VerticalAlignment.Stretch,
 Margin = new Thickness(5, 0, 5, 0),
 Symbology = new Code39()
 {
  AutoChecksum = false,
  ShowText = false,
  SizingMode = SizingMode.Stretch
 }
};

we have result https://ibb.co/k8hPdLp

Old barcode we can scan, but new barcode we cannot scan

Jan
Top achievements
Rank 1
Iron
 answered on 06 Mar 2023
1 answer
40 views

Dear Team,

I wanted to try the Radbarcodereader in WPF. I opened a new project with .Framework 4.7 

and i just pulled out a Radbarcodereader to an empty WPF window.

Simply started the app, and browsed some random images with barcodes, but every time i push the "decode image" i get IndexOutOfRangeException from the control.

All propertises of the control are on default, what do i have to set up to make it work?

I have tried without control, only by code:

    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
        Dim imageSource = img_Camera.Source
        Dim decoder As New BarcodeDecoder()
        decoder.ImageSource = imageSource
        AddHandler decoder.DecodingComplete, AddressOf OnDecodingComplete
        decoder.StartDecoding()
    End Sub
    Private Sub OnDecodingComplete(ByVal sender As Object, ByVal e As DecodingEventArgs)
        Dim decodeResult As String
        If String.IsNullOrEmpty(e.ErrorMessage) Then
            decodeResult = String.Format("Code Type: {0}" & ControlChars.Lf & "Result: {1}", e.CodeType, e.Result)
        Else
            decodeResult = e.ErrorMessage
        End If
        txt_RESULT.Text = decodeResult
    End Sub

 

At this line:     decoder.StartDecoding()

i also  get the IndexOutOfRangeException 

 

Please help :)

thanks

Peter B.

Dilyan Traykov
Telerik team
 answered on 26 Jan 2023
1 answer
69 views

I have RadBarcodeQR and I want to keep the white space outside the BarCode the same in all text.

Would appreciate help

<Grid>
        <StackPanel VerticalAlignment="Center">
            <TextBox Text="{Binding QrCode, UpdateSourceTrigger=PropertyChanged}" Width="300" Height="30" Margin="20"/>
            <telerik:RadBarcodeQR
                Height="100" 
                Width="100"
                Text="{Binding QrCode, UpdateSourceTrigger=PropertyChanged}"
                Foreground="Black"
                UseLayoutRounding="True">
                <telerik:RadBarcodeQR.Style>
                    <Style TargetType="telerik:RadBarcodeQR">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="telerik:RadBarcodeQR">
                                    <Grid 
                                        x:Name="PART_RadBarcodeQR" 
                                        Background="White" 
                                        Margin="15">
                                        <Image x:Name="ImageQrCode" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </telerik:RadBarcodeQR.Style>
            </telerik:RadBarcodeQR>
        </StackPanel>
    </Grid>

 

This is what it looks like with an empty string:

 

 

This is what it looks like with the string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

 

Dilyan Traykov
Telerik team
 answered on 24 Mar 2022
2 answers
67 views

Hi,

Is there a way I can insert text in Hebrew and scan it?

Because by default I see that it only supports English.

Thanks.

Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
 answered on 27 Jan 2022
1 answer
101 views

Hi,

I would be happy if you could help me how to download RadBarcodeQR as an image?

Thanks.

Martin Ivanov
Telerik team
 answered on 15 Oct 2021
4 answers
119 views
The legend text is getting cut off.  There does not seem to be any pattern to the issue.  I am using Microsoft Visual Studio Community 2019 and have Telerik installed.  I have created several graphs and have gone into the graph properties of the graph.  I selected Series --- <Then the bar Series> --- LegendItem and entered the value.  The text is getting cut off.  I have attached several screen shots. 

Martin Ivanov
Telerik team
 answered on 15 Jun 2020
5 answers
147 views

Hi,

I was trying to add a qr into a RadFixedDocument like this

RadBarcodeQR qr = new RadBarcodeQR();
qr.Mode = QRClassLibrary.Modes.CodeMode.Byte;
qr.Text = documentHistory.SerialId.ToString();
qr.Width = 88;
qr.Height = 88;
using (MemoryStream stream = new MemoryStream())
{
      Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(qr, stream, new PngBitmapEncoder());
 
      //RadFixedDocument
       document.InsertImage(stream, area);
}

 

I have the following error on this line: Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(qr, stream, new PngBitmapEncoder());

Parameter value must be greater then 0. ParameterName: pixelWidth
 
   in System.Windows.Media.Imaging.RenderTargetBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight, Double dpiX, Double dpiY, PixelFormat pixelFormat)
   in Telerik.Windows.Media.Imaging.ExportHelper.GetBitmapSource(FrameworkElement element, Double dpiX, Double dpiY)
   in Telerik.Windows.Media.Imaging.ExportHelper.GetElementImage(FrameworkElement element)
   in Telerik.Windows.Media.Imaging.ImageExporter.Export(FrameworkElement element, Stream stream, BitmapEncoder encoder)
   in Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(FrameworkElement element, Stream stream, BitmapEncoder encoder)
   in MileClient.DocumentUserControl.ExportAndViewDocumentWithImageStamp(DocumentHistoryEntity documentHistory) in D:\MyClient\Source\Gui\Wpf\UserControls\DocumentUserControl.xaml.cs:riga 714
   in MileClient.DocumentUserControl.OpenDocumentHistoryButton_Click(Object sender, RoutedEventArgs e) in D:\MyClient\Source\Gui\Wpf\UserControls\DocumentUserControl.xaml.cs:riga 614
   in System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   in System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   in System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   in System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   in System.Windows.Controls.Primitives.ButtonBase.OnClick()
   in System.Windows.Controls.Button.OnClick()
   in System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   in System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   in System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   in System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   in System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   in System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   in System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   in System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   in System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   in System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   in System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   in System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   in System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   in System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   in System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   in System.Windows.Input.InputManager.ProcessStagingArea()
   in System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   in System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   in System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   in System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   in System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   in MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   in MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   in System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   in System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Lance | Manager Technical Support
Telerik team
 answered on 05 Apr 2019
8 answers
438 views
Hi,
    Is there any way to save a RadBarcodeQR to binary or image? Then I could use it on a report until telerik reports support QR codes.

Thanks
Dinko | Tech Support Engineer
Telerik team
 answered on 14 Dec 2018
1 answer
73 views

Hello,

My project is in WPF MVVM with C# on visual studio 2013

I have implemented a RadBarCodeQR on my xaml page but it's not displayed in my design view

When I run the project this is the same, the QR Code is not displayed

 

Here is my xaml code:

<telerik:RadBarcodeQR Grid.Row="1" Grid.Column="2" Width="100" Height="100" Margin="10 10 20 10" HorizontalAlignment="Right" VerticalAlignment="Center" Mode="Alphanumeric" Text="ePI/A320/XX/P42/23052018/0900/30052018/1700/XXXXX/09/000000048/X/X/X"/>

 

Thank you !

Martin Ivanov
Telerik team
 answered on 21 May 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?