I'm newbie in .NET (WPF) and I'm stucked in somethin I guess it's really trivial.
I'm creating a FlowDocument
and a Table
from C# code.
When I'm about to create the rows, I need to insert a image inside the cells "Prediction"
// ******* TODAY ROW ******
oTable.RowGroups[0].Rows.Add(new TableRow());
currentRow = oTable.RowGroups[0].Rows[1];
//Configure the row layout
currentRow.Background = System.Windows.Media.Brushes.White;
currentRow.Foreground = System.Windows.Media.Brushes.Navy;
//Add the dayin the first cell
currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Today"))));
//Add the image in the second cell
BitmapImage bmp0 = new BitmapImage();
System.Windows.Controls.Image img0 = new System.Windows.Controls.Image();
bmp0.BeginInit();
bmp0.UriSource = new Uri("weather/cloudy.gif", UriKind.Relative);
bmp0.EndInit();
Paragraph oParagraph0 = new Paragraph();
oParagraph0.Background = new ImageBrush(bmp0);
currentRow.Cells.Add(new TableCell(oParagraph0));
As you can see, now I'm setting the image "bmp0" just as background of the paragraph... How can I set it as a normal Image (without resizing it as the background)?