What is the best way to print a complex layout spanning multiple pages in WPF? (for example an invoice layout spanning multiple pages because of many invoice items)
I'm guessing one of these methods would do:
Dynamically inserting pages in a FixedDocument? how?
Convert a FlowDocument to a FixedDocment. How? The solutions found do not seem to work in WPF 4 (fox example http://blogs.msdn.com/b/fyuan/archive/2007/03/10/convert-xaml-flow-document-to-xps-with-style-multiple-page-page-size-header-margin.aspx)
I typically use dynamic insertion of Pages into the FixedDocument control. I created a empty view and then dynamically load in UserControls that represent each pages "body" with their respective binding(s). The downside is you have to create your own poormans virtualization for dataset reprots (ie show 12 rows per page with a MOD 12 calculation etc) type thing.
Reports are low priority on the WPF teams Radar so this really hasn't got a lot of knowledge base around it at present and the future isn't so bright either.
Related
A lot of the websites these days is built using grids, pre-made or custom ones. What I noticed is that most of these grids are based on rows, and usually work with the width of the columns, not taking the height of the elements (modules) into account.
I was wondering what the best way (or what the possibilities are) of building a modular grid is? By modular grid I understand such grid where the individual modules could be set in both width and height and be fluid in dependence on the screen. A grid where you'd know you have let's say 12 columns and 9 rows (the width / height of each would be given), and you'd be able to fill it with modules like a mosaic (that makes it sound almost too simple).
Here's an example picture of what I have in mind (picture borrowed from here):
I came upon a couple of examples, but most of them weren't responsive or were built using Flash. I believe there is a way to do it, just not sure myself how.
I know there might not be ONE correct way, but I'm curious about the possible techniques to go about it. Thank you!
This layout technique is commonly known as masonry, here are a couple of responsive masonry links to get you started:
http://masonry.desandro.com
http://osvaldas.info/responsive-jquery-masonry-or-pinterest-style-layout
good luck!
I would have to say your best option would be to build it using Bootstrap or Foundation, since they are set up to handle this kind of thing.They have classes that, assuming you use a 12 column grid to start, let you pick how many columns they can take up.
links:
http://getbootstrap.com/
http://foundation.zurb.com/
In my application, I'm generating a FlowDocument with several paragraphs of text.
Using a FlowDocumentScrollViewer , I can display the document in my UI. If the document is too long for the available space, the FlowDocumentScrollViewer does it's job and introduces a vertical scrollbar. All good.
If I use a FlowDocumentPageViewer the response to show additional pages of text, also as designed.
However, what I want in my application is for the viewer to grow wider.
So, for a short document, the viewer is narrow (say, around 360 pixels with one column of text), but for a longer document the viewer is wider (say, around 720 pixels with two columns of text). An even longer document would expand to three columns, and so on.
I've seen a number of WinRT applications that do this kind of thing - The New Zealand Herald has one app. But, I'm working in regular WPF and have ended up stumped.
How can I display a FlowDocument so that it's all visible at once - no scrollbars, no pagination, just multiple columns of text stretching across?
Why do I want this? I'm showing several disparate pieces of information on a single page, and I want to have a single horizontal scrollbar for panning across the lot, not separate scrollbars for each piece. For example, I've got my ListBoxes working this way by using a WrapPanel as the ItemsPanelTemplate - when there are too many items for one column, another column opens up and the listbox gets wider to accomodate.
I have a silverlight application which consists of a few tabs, which I would like to print or to generate PDF containing these tabs.
I tried to use StackPanel to add each tab and then use PrintDocument to print what I see, but there is a problem because there are too many tabs, so they don't fit in the size of A4 document.
And more, when I resize the browser to a smaller size, only the visible part of the content gets printed.
Is there a different method to print all the content in one document or PDF?
The PrintPageEventArgs in the PrintPage handler contains the size of the paper so you can calculate how much can be printed on a single page.
Printing (a part of) the visual tree has its disadvantages; what looks good on screen might not be good for paper, especially if scrolling and sizing are involved.
A solutions is to design one or multiple Views for printing and simply bind the same ViewModel to the PrintView. A bit like the special CSS for creating a print version of a web page.
If the content doesn't fit you should use more pages.
This article by Charles Petzold is worth reading too
I want to show a list of items from a database. The number of items could be anything between 10 to a 1000; well not a 1000 but at least more than 20 or so cards that have some texual details and a small thumbnail image. I want them to be displayed as similar to the list of folders in windows explorer when the view slider is in "Large Icons" position. I think I can accomplish that using this example while using a traditional listbox. But that makes the listbox scroll motion very boring.
Using a pathlistbox, I have a little more control over the list motion path. However, in all the online samples I have seen, there are only a few items that can be shown using a pathlistbox. I don't suppose I can show more than 20 cards in a circle or any other shape with all the aforementioned details. It will be really hard to scroll through them. Is the pathlistbox only for gimmicks or can I really use it to show many more than just a handful of items? Any tips or pitfalls in the Pathlistbox that I should be aware of before I begin using it or am I better off using just the simple listbox?
Would like to have your thoughts on the same. Thanks for your time...
i want to display a table (like a footbal table) in silverlight in a windows phone 7 app. i was reading a bunch of articles on the www, but couldn't really understood what's the best way to approch this issue.
i am new to silverlight, so some code would be really awsome. I keep the data i have to display in some Lists (List), but i could change this...
any advices? thank you in advance!
naic
Due to the form factor [of almost all mobile devices] lists are much easier to read.
You will see this in the default templates for WP7.
There are various ways you can create a "table" in Silverlight. (I assume you are refering to a league table.) The easiest would probably be a grid or a templated list.
If you really must do this I would suggest having 2 different ways of displaying the data depending on screen orientation.
In the portrait orientation I would show a list with minimal statistics.
In the landscape orientation I would show a table layout which could include multiple statistics as there is more horizontal space.