|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using IssueVision.Data.Web;
namespace IssueVision.Common
{
public partial class ReportPrintout : UserControl
{
public int NumItemsShown { get; private set; }
public ReportPrintout(WriteableBitmap wb)
{
InitializeComponent();
// set the charts bitmap
this.image_Charts.Source = wb;
}
public void Paginate(IEnumerable<Issue> issuesToPrint, int startIndex, bool isFirstPage, Size pageSize)
{
if (!isFirstPage)
{
this.rowDefinition_Charts.Height = new GridLength(0);
this.grid_Charts.Visibility = Visibility.Collapsed;
}
this.stackPanel_Issues.Children.Clear();
this.UpdateLayout();
foreach (var issue in issuesToPrint.Skip(startIndex))
{
this.stackPanel_Issues.Children.Add(new ContentPresenter() { Content = issue, ContentTemplate = this.issueTemplate, HorizontalAlignment = HorizontalAlignment.Stretch });
this.UpdateLayout();
if (this.DesiredSize.Height >= pageSize.Height)
{
this.stackPanel_Issues.Children.RemoveAt(stackPanel_Issues.Children.Count - 1);
break;
}
}
this.UpdateLayout();
NumItemsShown = this.stackPanel_Issues.Children.Count;
this.textBlock_TitleText.Text = string.Format("Issue Report (Issues {0} through {1})", startIndex + 1, startIndex + NumItemsShown);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET