How to add image from code?
How to add image from code?
Hello,
I am trying to add new variable ( type of image ) from code behind. So i can use that variable in silverlight designer. But it doesn't work until now. I am using the following code :
StiDesignecontrol = new StiSLDesignerControl();
StiReport report = new StiReport();
if (byteArray != null)
{
report.Load(byteArray);
}
if (logodata != null)
{
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(new MemoryStream(logodata));
StiImage image = new StiImage();
image.Image = bitmap;
StiVariable logo = new StiVariable("My Variables", "Logo", "Logo", typeof(System.Drawing.Bitmap),"",false);//new StiVariable("My variables", "Logo", "Logo", "", typeof(System.Drawing.Bitmap), "", false, false, false);
logo.ValueObject = image;
report.Dictionary.Variables.Add(logo);
report.Dictionary.Synchronize();
}
report.Render();
StiDesignecontrol.Report = report;
Regards,
Jalal
I am trying to add new variable ( type of image ) from code behind. So i can use that variable in silverlight designer. But it doesn't work until now. I am using the following code :
StiDesignecontrol = new StiSLDesignerControl();
StiReport report = new StiReport();
if (byteArray != null)
{
report.Load(byteArray);
}
if (logodata != null)
{
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(new MemoryStream(logodata));
StiImage image = new StiImage();
image.Image = bitmap;
StiVariable logo = new StiVariable("My Variables", "Logo", "Logo", typeof(System.Drawing.Bitmap),"",false);//new StiVariable("My variables", "Logo", "Logo", "", typeof(System.Drawing.Bitmap), "", false, false, false);
logo.ValueObject = image;
report.Dictionary.Variables.Add(logo);
report.Dictionary.Synchronize();
}
report.Render();
StiDesignecontrol.Report = report;
Regards,
Jalal
How to add image from code?
Hello,
Your code is correct. Variables for the Image type did not work correctly. We have made changes that will be available tomorrow in prerelease build.
Thank you.
Your code is correct. Variables for the Image type did not work correctly. We have made changes that will be available tomorrow in prerelease build.
Thank you.
How to add image from code?
Thanks for you reply,
I will wait the coming prerelease.
Regards,
Jalal
I will wait the coming prerelease.
Regards,
Jalal
How to add image from code?
Hello,
Let us know if you need any additional help.
Thank you.
Let us know if you need any additional help.
Thank you.
How to add image from code?
Hello,
when i added an image in silverlight using the last prerelease (Stimulsoft Reports.Silverlight 2011.04.12 Trial), I notice that it doesn't work in the preview( i cant see the image, but just this "System.window.media.imaging.bitmapimage". ( preview here means 'StiSLDesignerControl' preview ).
However, it works good when i save mrt and open it using the designer. As a result i think that the image is loaded in the variable but there is something wrong when try to preview it in silverlight viewer!
Regards,
Jalal
when i added an image in silverlight using the last prerelease (Stimulsoft Reports.Silverlight 2011.04.12 Trial), I notice that it doesn't work in the preview( i cant see the image, but just this "System.window.media.imaging.bitmapimage". ( preview here means 'StiSLDesignerControl' preview ).
However, it works good when i save mrt and open it using the designer. As a result i think that the image is loaded in the variable but there is something wrong when try to preview it in silverlight viewer!
Regards,
Jalal
-
- Posts: 135
- Joined: Tue Aug 11, 2009 9:38 am
How to add image from code?
Hello,
The problem is fixed. The patch is available in prerelease build of on 19.04.2011.
Let us know if you need any additional help.
Thank you.
The problem is fixed. The patch is available in prerelease build of on 19.04.2011.
Let us know if you need any additional help.
Thank you.
How to add image from code?
Hello,
I create a variable in code behind like this :
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(new MemoryStream(logodata));
StiVariable logo = new StiVariable("My variables", "Logo", "Logo", "", typeof(System.Drawing.Bitmap), "", false, false, false);
logo.ValueObject = bitmap;
report.Dictionary.Variables.Add(logo);
But when i drag this variable to report area ( in designer), it doesn't appear same as when add new sti image !!
I mean it doesn't work in preview!
But,
If i add new sti image in designer, and assign imagedata = {Logo}, then it will work!
My question, how i can add sti variable of type image, then user can drag and drop it, so image will be shown in preview ??
I hope if you send me a sample.
Regards,
Jalal
I create a variable in code behind like this :
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(new MemoryStream(logodata));
StiVariable logo = new StiVariable("My variables", "Logo", "Logo", "", typeof(System.Drawing.Bitmap), "", false, false, false);
logo.ValueObject = bitmap;
report.Dictionary.Variables.Add(logo);
But when i drag this variable to report area ( in designer), it doesn't appear same as when add new sti image !!
I mean it doesn't work in preview!
But,
If i add new sti image in designer, and assign imagedata = {Logo}, then it will work!
My question, how i can add sti variable of type image, then user can drag and drop it, so image will be shown in preview ??
I hope if you send me a sample.
Regards,
Jalal
-
- Posts: 135
- Joined: Tue Aug 11, 2009 9:38 am
How to add image from code?
Hello,
We create an example for you, please see.
Thank you.
We create an example for you, please see.
Thank you.
- Attachments
-
- 930.SilverlightApplication4.zip
- (6.5 KiB) Downloaded 487 times