Telerik Forums
UI for WPF Forum
1 answer
159 views
Hello all,
I have the following problem when using the mail merge:
If I do not have watermark in the document, MailMerge and Export to PDF performs correctly.
Here is how I do the MailMerge (not full code):

//loop throught documents
do
{
    RadDocument currentDocument = document.MailMergeCurrentRecord();
    if (currentDocument != null)
    {
        //freeze images
        foreach (var image in currentDocument.EnumerateChildrenOfType<ImageInline>())
            image.ImageSource.Freeze();
 
        //Floating images
        foreach (var image in currentDocument.EnumerateChildrenOfType<FloatingImageBlock>())
            image.ImageInline.ImageSource.Freeze();
 
        lock (baton)
            documentQueue.Enqueue(currentDocument);//add new document to a queue for further processing
        currentDocument = null;
    }
 
} while (document.MailMergeDataSource.MoveToNext());


and here is how I export to PDF (into a stream):
public static async Task<Stream> ExportToPDF(RadDocument document)
{
    PdfFormatProvider provider = new PdfFormatProvider();
    Stream output = new MemoryStream();
 
    await StartSTATask(() =>
    {
        provider.Export(document, output);
    });
    output.Position = 0;
    return output;
}


As I have mentioned, the problem occurs when I have a Watermark in my document. Even though Mail Merge performs correctly, the document crashes on the 
provider.Export(document, output) saying that the current thread cannot access object as different thread owns it.

Here is full error report:

at System.Windows.Threading.DispatcherObject.VerifyAccess()
   at System.Windows.Media.Imaging.BitmapSource.get_PixelWidth()
   at System.Windows.Media.Imaging.WriteableBitmap.InitFromBitmapSource(BitmapSource source)
   at Telerik.Windows.Media.Imaging.RadBitmap..ctor(BitmapSource image)
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfDocumentExporter.SetImageAlpha(WatermarkImageSettings imageSettings, Byte alpha)
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfDocumentExporter.DrawWatermark(Header header, SectionLayoutBox sectionBox, PdfContentsWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfDocumentExporter.ExportHeadersAndFooters(SectionLayoutBox sectionBox, PdfContentsWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfDocumentExporter.ExportPage(SectionLayoutBox sectionBox, PdfContentsWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfDocumentExporter.<>c__DisplayClass1.<Export>b__0(PdfContentsWriter contentsWriter)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfContents.WriteContents(PdfWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfStream.WriteToCore(PdfWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfObject.WriteTo(PdfWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfWriter.WritePdfObject(PdfObject obj)
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfDocumentExporter.Export()
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfFormatProvider.Export(RadDocument document, Stream output)
   at IP_DocumentProcessor.MailMerge.IP_MailMerge.<>c__DisplayClass14.<ExportToPDF>b__13() in d:\VB Projects + Silverlight\VS2012APP\IP_DocumentProcessor\IP_DocumentProcessor\MailMerge\IP_MailMerge.cs:line 476
   at IP_DocumentProcessor.MailMerge.IP_MailMerge.<>c__DisplayClass1a.<StartSTATask>b__19() in d:\VB Projects + Silverlight\VS2012APP\IP_DocumentProcessor\IP_DocumentProcessor\MailMerge\IP_MailMerge.cs:line 500
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at IP_DocumentProcessor.MailMerge.IP_MailMerge.<StartSTATask>d__1c.MoveNext() in d:\VB Projects + Silverlight\VS2012APP\IP_DocumentProcessor\IP_DocumentProcessor\MailMerge\IP_MailMerge.cs:line 510
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IP_DocumentProcessor.MailMerge.IP_MailMerge.<ExportToPDF>d__16.MoveNext() in d:\VB Projects + Silverlight\VS2012APP\IP_DocumentProcessor\IP_DocumentProcessor\MailMerge\IP_MailMerge.cs:line 474
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at IP_DocumentProcessor.MailMerge.IP_MailMerge.<GenerateStreams>d__7.MoveNext() in d:\VB Projects + Silverlight\VS2012APP\IP_DocumentProcessor\IP_DocumentProcessor\MailMerge\IP_MailMerge.cs:line 282
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__1(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()


Your help would be highly appreciated as I don't know how to handle this problem.
Thank you.
Robert
Boby
Telerik team
 answered on 27 Feb 2015
1 answer
173 views
Hi,

I would like to know how it's possible to dock center a SplitContainer?

Thank's
Alain
Nasko
Telerik team
 answered on 27 Feb 2015
8 answers
267 views
Hi,

I looking for a kind of tabular layout.
The idea behind it is that in my data I know Row and Column and I want my diagram to look
something like in the attached images.

And I also need Multiple root items like showed on the second image.

The next thing is that I want to restrict node dragging to the matrix - inclusive position change (like drag drop in a treeview control for an example). But this is "enhanced" - my initial request is to generate the layout from data - just by knowing
a.) Node Position Row, Column
b.) Node connected to List of other Nodes

Is this possible - "out of the box" (or with little effort)?

Thanks
Manfred
Petar Mladenov
Telerik team
 answered on 27 Feb 2015
1 answer
172 views
Is it possible to pin a RadDocumentPane like the tabs in VS 2013?
Thanks in advance,
Steve
Vladi
Telerik team
 answered on 27 Feb 2015
1 answer
133 views
Hi

I like this menu, but it would be nice to have more than eight slice.
Kalin
Telerik team
 answered on 27 Feb 2015
1 answer
360 views
1.3.2.4 You must include a valid copyright message in Your Integrated Products in a location viewable by Authorized End-Users (e.g. “About” box) that will serve to protect Telerik’s copyright and other intellectual property rights in the Software.
Kalin
Telerik team
 answered on 27 Feb 2015
1 answer
197 views
Am I able to build any kind of functioning shortcut menu into the GridView accessible thru a right mouse click?

Thanks,

Tony
Boris
Telerik team
 answered on 27 Feb 2015
1 answer
162 views
Hi!

When I bind a GridView to an QCV and klick in a cell the cell/row is in edit-mode and I can change the content of the cell. The moment I use a CellTemplate this functionality is gone, no automatic edit-mode, nothing. Here the example which works:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
    UniqueName="BoilerplateName"
    IsGroupable="False"
    Width="200"
    Header="Name" />

This one is not working - no edit-mode whatsoever:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
                           UniqueName="BoilerplateName"
                           IsGroupable="False"
                           Width="200"
                           Header="Name">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                     AcceptsReturn="True"
                     MaxLength="4000"
                     TextWrapping="Wrap" />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>



Boris
Telerik team
 answered on 27 Feb 2015
8 answers
538 views
Hello,
in my ribbon, I have added a DropDownButton that contains a ContextMenu, following the example in Telerik documentation.
This works well... until the menu contains a sub menu. In this case, as soon as the sub menu is opened, the menu is not closed when we click outside it, only the sub menu is closed.
Patrick
Petar Mladenov
Telerik team
 answered on 27 Feb 2015
8 answers
382 views
Hi,

I want to know if it's possible to dynamically load the radCarousel and set it's itemsource in C# at runtime?

Basically I have a winform application I am integrating a WPF carousel into. The user will use a drop down selection box to choose which set of data to represent. That selected item will send a variable to the carousel, C# logic will dynamically query a SQL Server database and present the returned data in the carousel as selectable items.

That's the goal anyway. Thanks in advance for your help!

Tony
Tony
Top achievements
Rank 1
 answered on 26 Feb 2015
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?