Telerik Forums
Reporting Forum
4 answers
124 views

I am using MAF (System.Addin) to display a WPF control onto a shared main form. When I add the telerik reportviewer I am getting a exception that I am trying to access a different thread then the one that owns the control. If you look through the exception stack you can see a reference to Application.Mainwindow however, since I am in a Addin the application mainwindow does not belong to my domain.

Is there a way to set the Application.Mainwindow inside of a Addin object?

System.Windows.Markup.XamlParseException occurred
 
Message=Cannot create instance of 'RadSlider' defined in assembly 'Telerik.Windows.Controls, Version=2010.3.1110.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'. Exception has been thrown by the target of an invocation.  Error at object 'System.Windows.Controls.StackPanel' in markup file 'Telerik.ReportViewer.Wpf;component/Themes/Default/ReportViewer.xaml'.
 
Source=PresentationFramework
 
LineNumber=0
 
LinePosition=0
 
NameContext=87_T
 
StackTrace:
       at
System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
       at
System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
       at
System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
       at
System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
       at
System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
       at
System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
       at
System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
       at
System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
       at
System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
       at
System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
       at
System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
       at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`
1 templateDataField, FrameworkElement container)
       at
System.Windows.FrameworkElement.ApplyTemplate()
       at
System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at
System.Windows.UIElement.Measure(Size availableSize)
       at MS
.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at
System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at
System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at
System.Windows.UIElement.Measure(Size availableSize)
       at
System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at
System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at
System.Windows.UIElement.Measure(Size availableSize)
       at
System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at
System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at
System.Windows.UIElement.Measure(Size availableSize)
       at
System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
       at
System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at
System.Windows.UIElement.Measure(Size availableSize)
       at
System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
       at
System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
       at
System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at
System.Windows.UIElement.Measure(Size availableSize)
       at
System.Windows.Interop.HwndSource.SetLayoutSize()
       at
System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       at
System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       at
System.Windows.Forms.Integration.ElementHost.OnHandleCreated(EventArgs e)
       at
System.Windows.Forms.Control.WmCreate(Message& m)
       at
System.Windows.Forms.Control.WndProc(Message& m)
       at
System.Windows.Forms.Integration.ElementHost.WndProc(Message& m)
       at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at
System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at
System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at
System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       at
System.Windows.Forms.Control.CreateHandle()
       at
System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at
System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at
System.Windows.Forms.Control.CreateControl()
       at
System.Windows.Forms.Control.WmShowWindow(Message& m)
       at
System.Windows.Forms.Control.WndProc(Message& m)
       at
System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at
System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at
System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at
System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at
System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       at
System.Windows.Forms.Control.CreateHandle()
       at
System.Windows.Forms.Control.get_Handle()
       at
System.Windows.Forms.Integration.WindowsFormsHost.BuildWindowCore(HandleRef hwndParent)
       at
System.Windows.Interop.HwndHost.BuildWindow(HandleRef hwndParent)
       at
System.Windows.Interop.HwndHost.BuildOrReparentWindow()
       at
System.Windows.Interop.HwndHost.OnSourceChanged(Object sender, SourceChangedEventArgs e)
       at
System.Windows.SourceChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at
System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at
System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at
System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at
System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at
System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at
System.Windows.PresentationSource.UpdateSourceOfElement(DependencyObject doTarget, DependencyObject doAncestor, DependencyObject doOldParent)
       at
System.Windows.PresentationSource.RootChanged(Visual oldRoot, Visual newRoot)
       at
System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       at
System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       at
System.AddIn.Pipeline.FrameworkElementAdapters.ViewToContractAdapter(FrameworkElement root)
       at DRIP
.AddIn.Adapter.DRIPAddInViewToContractAdapter.UrlHandler(String uri)
 
InnerException: System.Reflection.TargetInvocationException
       
Message=Exception has been thrown by the target of an invocation.
       
Source=mscorlib
       
StackTrace:
            at
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
            at
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
            at
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
            at
System.Activator.CreateInstance(Type type, Boolean nonPublic)
            at
System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
       
InnerException: System.InvalidOperationException
           
Message=The calling thread cannot access this object because a different thread owns it.
           
Source=WindowsBase
           
StackTrace:
                 at
System.Windows.Threading.Dispatcher.VerifyAccess()
                 at
System.Windows.Threading.DispatcherObject.VerifyAccess()
                 at
System.Windows.Application.get_MainWindow()
                 at
Telerik.Windows.Controls.RadSlider..ctor() in c:\Builds\WPF_Scrum\Release_WPF_2010_Q3\Sources\Development\Core\Controls\Slider\RadSlider.cs:line 217
           
InnerException:
Kiril Stanoev
Telerik team
 answered on 26 Nov 2010
1 answer
145 views
Hello.

I just basically installed Telerik Reporting. Created a new class library. Went to Add New item -> Telerik Report.

Added a textbox and a picture, hit "Preview" and get

"The source of the report definition has not been specified.".

Why is this? Shouldn't i be able to simply just preview just the simplest of things? Feels like something is very wrong, maybe I have to reinstall.

VS 2010.

/E
Steve
Telerik team
 answered on 25 Nov 2010
1 answer
76 views
Hi I am having a requirement where I am having a dataservice(wcf data service or ado.net service) which I shuould use as a datasource for report. how can I do this? Please guide me.


Regards,
Abhinay
Peter
Telerik team
 answered on 25 Nov 2010
1 answer
205 views
Hi,

I was wondering if it is posible to have a textbox that is visible when viewed through a viewer but is hidden if/when the report is printed off.
Peter
Telerik team
 answered on 25 Nov 2010
3 answers
218 views
I'm having some difficulties running the Silverlight viewer against the self hosted WCF service example in the latest documentation.

Upon setting the ReportServiceUri and report qualified name the viewer starts to load then displays this text in the main report window :
An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.

I can't trap the exception and get at the innerException details, it seems to throw within the component.

I think the service is hosted OK as It works fine using the HTTP Get method described in the example to get the PDF export into the browser.

Has anyone else got this working ?
Massimiliano Bassili
Top achievements
Rank 1
 answered on 25 Nov 2010
6 answers
746 views
Hi,

I've develpoed a dozen Telerik reports for my application.

I connect to any handy datasource to design and preview reports but in production I always supply a dataset myself like this...

Public Sub New(ByVal sConn As String, ByVal sSQL As String, ByVal ReportTitle As String)
       InitializeComponent()
        Dim ds As DataSet = SnagRData1.getDataSet(sSQL, sConn, "qSchedXtab")
        Dim dt As DataTable
        dt = ds.Tables("qSchedXtab")

        Me.DataSource = dt
    End Sub

This works fine for everything except my new xtab report where I get the exception - the data is present and correct but the report crashes the development PC as it trys in vain to use the data passed to it.

If I delete the SQLdatasource1 used to preview it still cannot match the data correctly.

Please help
Steve
Telerik team
 answered on 25 Nov 2010
3 answers
136 views
Hi Friends,
                   I have been using the below code to save my report.
                  
void SaveReport(Telerik.Reporting.Report report, string fileName) 
    { 
        ReportProcessor reportProcessor = new ReportProcessor(); 
        RenderingResult result = reportProcessor.RenderReport("PDF", report, null); 
 
        using (FileStream fs = new FileStream(fileName, FileMode.Create)) 
        { 
            fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); 
        } 
    }     

But how to make a report from code behind for a large table.I have referred the following link
http://www.telerik.com/help/reporting/programmatic-control-of-reports.html. Its ok for tables with few columns.I have also seen the code from InitializeComponent() of the designer.cs file.I want everything to work from code behind(Creating report,Assigning SqlDatasource and so on.) Can any one help me.Can any one give a sample code for large table queries. Im not using ReportViewer to see the report.I just want to save my report as file.


          Telerik.Reporting.Report report = new Telerik.Reporting.Report();
            Telerik.Reporting.SqlDataSource dataSource = new Telerik.Reporting.SqlDataSource();
            dataSource.ProviderName = "System.Data.SqlClient";
            dataSource.ConnectionString = @"Data Source =(local)\SQLEXPRESS2008;
                                 Initial Catalog=TestDb;Integrated Security=True;Pooling=False";
            dataSource.SelectCommand = @"SELECT * FROM [TestTable]";
            report.DataSource = dataSource;

Wat to do after this if my 'TestTable from Db 'has more than 20 columns and more rows..Can i use Telerik.Reporting.Table for this??


Regards and Thanks
Titti.S





Massimiliano Bassili
Top achievements
Rank 1
 answered on 25 Nov 2010
1 answer
145 views
What does reset style do?....I mean I can GUESS :)  But it seems like it's not resetting all the properties.

I've got two textboxes, both I want to look the same.  So the one I just freshly dropped onto the report looks default (arial 10).  Then there's another one who's got Tahoma, grey color, aligned right.  If I copy the style if the new box I dropped and paste it into the Tahoma one, nothing changes.  I assume this is becasue "Default" isn't a style?  I would assume though that the properties set on the one textbox should propagate to the other one since the default settings are still technically a style.

Ok, so given that didn't work I tried in the opposite direction.  Copied the style from the tahoma and pasted it into the new one and everything worked great....however that's not what I wanted so I tried a Reset Style on both.

I got Arial 10pt on the one box, and Tahoma 11pt on the other.

What is it resetting it to?
Steve
Telerik team
 answered on 24 Nov 2010
1 answer
103 views
I  created   a  report   to display   a  bar  chart.
I  added  this   report  as  a  sub report  inside    the  group header of another  report.
The  problem  is  Chart  individually  executing well and giving  correct results. 
But  after  adding the this report  as a sub report to another report  the  chart is not being  displayed  well.  
Steve
Telerik team
 answered on 24 Nov 2010
2 answers
186 views
I have a drop down parameter that list 2000+ items. Is there a way to limit this and function like your combobox. For example have the user type and auto find using a like statement that brings back the top 50 items.


thanks
Dwayne Starkey
Top achievements
Rank 1
 answered on 24 Nov 2010
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?