Hi;
Is there any plan to build SL printing capability into this control?
If yes, it would be great to be able to include a text above the barcode as "Title" and then the barcode text below the barcode. This way, when lots of barcodes are printed, they can easily be distributed by title and text info.
Hi Ben,
Thank you for your feedback.
As the XamBarcode is a Silverlight control you could easily use the printing capabilities of Silverlight 4 as the sample below does. Regarding a Title, we do not consider that such a property should be a part of the XamBarcode control. You could override the template of the control or just add a textblock and position it where you want it the way it's demonstrated in the following sample:
<Grid x:Name="LayoutRoot" Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="30"/> </Grid.ColumnDefinitions> <StackPanel x:Name="BarcodeContainer"> <TextBlock HorizontalAlignment="Center" >Code 128 Barcode Title</TextBlock> <ig:XamCode128Barcode x:Name="Barcode" Data="123" /> </StackPanel> <Button x:Name="ButtonPrint" Width="30" Height="20" Click="ButtonPrint_Click" Grid.Column="1">Print</Button></Grid>
private void ButtonPrint_Click(object sender, RoutedEventArgs e){ PrintDocument doc = new PrintDocument(); doc.PrintPage += new EventHandler<PrintPageEventArgs>(doc_PrintPage); doc.Print("sample name");}void doc_PrintPage(object sender, PrintPageEventArgs e){ e.PageVisual = BarcodeContainer; //give the name of the container we want to be printed}
Let us know if you have some further questions.
Thank you Petia;
Your approach was my next solution, but I thought the printing was part of the control. But you clarified me. Thanks!