I have a WPF Library project, and when i run it in visual studio it runs perfect, and the print function works as it should, but when i open the project from another application and print it, the checkboxes are always empty.
I tried it without binding and with binding, but the checkboxes are always empty.
How is this possible??
Checkbox is like this:
<CheckBoc IsChecked="true"/>
and when i print it from visual studio it's checked but when i open the DLL with another application and print it to xps or printer, it's unchecked.
The checkbox is in a view and when i click on a button, the view is added to an fixedpage and this is sended to the printer with printdialog. There is nothing special in code.
Code to create fixedpage
// select printer and get printer settings
PrintDialog pd = new PrintDialog();
if (pd.ShowDialog(appView) != true) return;
// create a document
FixedDocument document = new FixedDocument();
document.DocumentPaginator.PageSize = new Size(pd.PrintableAreaWidth, pd.PrintableAreaHeight);
// create pages
FixedPage fixedPage = new FixedPage();
fixedPage.Width = document.DocumentPaginator.PageSize.Width;
fixedPage.Height = document.DocumentPaginator.PageSize.Height;
IPageViewModel pageModel = _applicationViewModel.CurrentPageViewModel;
UserControl pageView = this.GetView(pageModel);
// Add Viewmodel to Page 1
pageView.DataContext = pageModel;
pageView.Width = fixedPage.Width - 10;
pageView.Height = fixedPage.Height - 10;
pageView.Margin = new Thickness(60, 0, 10, 10);
fixedPage.Children.Add(pageView);
// add the pages to the document
PageContent overviewContent = new PageContent();
((IAddChild)overviewContent).AddChild(fixedPage);
document.Pages.Add(overviewContent);
/// and print
pd.PrintDocument(document.DocumentPaginator, "Document");
Thanks, Xander