|
using System.Collections.Generic;
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
image_Charts.Source = wb;
}
public void Paginate(IEnumerable<Issue> issuesToPrint, int startIndex, bool isFirstPage, Size pageSize)
{
if (!isFirstPage)
{
rowDefinition_Charts.Height = new GridLength(0);
grid_Charts.Visibility = Visibility.Collapsed;
}
stackPanel_Issues.Children.Clear();
UpdateLayout();
foreach (var issue in issuesToPrint.Skip(startIndex))
{
stackPanel_Issues.Children.Add(new ContentPresenter { Content = issue, ContentTemplate = issueTemplate, HorizontalAlignment = HorizontalAlignment.Stretch });
UpdateLayout();
if (DesiredSize.Height >= pageSize.Height)
{
stackPanel_Issues.Children.RemoveAt(stackPanel_Issues.Children.Count - 1);
break;
}
}
UpdateLayout();
NumItemsShown = stackPanel_Issues.Children.Count;
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