private void buttonPrint_Click(object sender, RoutedEventArgs e)
{
PrintDocument doc = new PrintDocument();
doc.PrintPage += new EventHandler<PrintPageEventArgs>(doc_PrintPage);
doc.Print();
}
void doc_PrintPage(object sender, PrintPageEventArgs e)
{
//simply set the PageVisual property to the UIElement
//that you want to print
e.PageVisual = canvas;
e.HasMorePages = false;
}