|
dataGrid.PrintSettings.PrintManagerBase = new CustomPrintManager(this.dataGrid);
this.dataGrid.PrintSettings.PrintPreviewWindowStyle = App.Current.Resources["PrintWindowStyle"] as Style;
this.dataGrid.PrintSettings.AllowPrintByDrawing = false;
this.dataGrid.PrintSettings.AllowPrintStyles = false;
this.dataGrid.ShowPrintPreview();
public class CustomPrintManager : GridPrintManager
{
public CustomPrintManager(SfDataGrid grid)
: base(grid)
{
}
protected override object GetColumnElement(object record, string mappingName)
{
var columnElement = base.GetColumnElement(record, mappingName) as TextBlock; if (columnElement != null)
{
columnElement.Foreground = new SolidColorBrush(Colors.Blue);
}
return columnElement;
}
protected override UIElement GetColumnHeaderElement(string mappingName)
{
var columnElement = base.GetColumnHeaderElement(mappingName) as TextBlock; if (columnElement != null)
{
columnElement.Foreground = new SolidColorBrush(Colors.Blue);
}
return columnElement;
}
} |