Hot to bind FieldValue to a Image Control??

Stimulsoft Reports.Silverlight discussion
yasminteles
Posts: 7
Joined: Tue Dec 04, 2012 1:37 am

Re: Hot to bind FieldValue to a Image Control??

Post by yasminteles »

Hello.

About load image in database I resolved the problem, but I need load image in project.

Code: Select all

        servicoWCF.ConsultaRelatorioAsync();

        void servicoWCF_ConsultaRelatorioCompleted(object sender, ConsultaRelatorioCompletedEventArgs e)
        {
            if (e.ncErro == null && e.Result != null)
            {
                Data dataRelatorio = new Data();
                Data.ncConteudoCollection conteudoColecao;
                Data.ConteudoItem conteudo;

                foreach (ncRelatorio1 item in e.Result)
                {
                    conteudo = new Data.ConteudoItem();
                    
                    //Name
                    conteudo.Info03 = item.Info2;   
                    //Company
                    conteudo.Info04 = item.Info3;   

                    //*********************************************************************************
                    //doubt 1 - Image is in project (Company Logo)                    
                    BitmapImage bitmapImage = new BitmapImage(new Uri("/nc.Relatorio;component/Recursos/Imagens/Logo.png", UriKind.Relative));

                  [size=150][color=#FF0040] //Error when trying to convert with StiImageConverter (Error: Object reference not set to an instance of an object)
                    byte[] image = StiImageConverter.ImageToBytes(bitmapImage);    [/color][/size]

                    //conteudo.Info49 - byte[] type in Stimulsoft Businnes Object. I am using the DataColumn property for the image component.
                    conteudo.Info49 = image;                

                    //The example http://forum.stimulsoft.com/viewtopic.php?f=11&t=4498 - 1067.SilverlightApplication1.zip also contains this error

                    dataRelatorio.Conteudo.Add(conteudo);
                }

                System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();                
                StreamReader reader = new StreamReader(a.GetManifestResourceStream("nc.Relatorio.Relatorios.NR0101.mrt"));
                StiReport report = new StiReport();
                report.Load(reader.BaseStream);
                reader.Close();
                reader.Dispose();
                report.CalculationMode = StiCalculationMode.Interpretation;
                report.RegBusinessObject("Data", "Data", dataRelatorio);

                report.Render();
                report.Show();

            }
        }

Please, help me.

Thank's
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Hot to bind FieldValue to a Image Control??

Post by Alex K. »

Hello,

Can you please send us a sample project which reproduce the issue for analysis.

Thank you.
Locked