How to add image from code?
Posted: Sun Apr 10, 2011 1:52 am
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